/** * Decrement value of {@literal key} by 1. * * @param key must not be {@literal null}. * @return * @see <a href="http://redis.io/commands/decr">Redis Documentation: DECR</a> */ default Mono<Long> decr(ByteBuffer key) { Assert.notNull(key, "Key must not be null!"); return decr(Mono.just(new KeyCommand(key))).next().map(NumericResponse::getOutput); }
/** * Get size of hash at {@literal key}. * * @param key must not be {@literal null}. * @return * @see <a href="http://redis.io/commands/hlen">Redis Documentation: HLEN</a> */ default Mono<Long> hLen(ByteBuffer key) { Assert.notNull(key, "Key must not be null!"); return hLen(Mono.just(new KeyCommand(key))).next().map(NumericResponse::getOutput); }
/** * Get the size of sorted set with {@literal key}. * * @param key must not be {@literal null}. * @return * @see <a href="http://redis.io/commands/zcard">Redis Documentation: ZCARD</a> */ default Mono<Long> zCard(ByteBuffer key) { Assert.notNull(key, "Key must not be null!"); return zCard(Mono.just(new KeyCommand(key))).next().map(NumericResponse::getOutput); }
/** * Get the time to live for {@code key} in milliseconds. * * @param key must not be {@literal null}. * @return * @see <a href="http://redis.io/commands/ttl">Redis Documentation: TTL</a> */ default Mono<Long> pTtl(ByteBuffer key) { Assert.notNull(key, "Key must not be null!"); return pTtl(Mono.just(new KeyCommand(key))).next().map(NumericResponse::getOutput); }
/** * Get the size of list stored at {@literal key}. * * @param key must not be {@literal null}. * @return * @see <a href="http://redis.io/commands/llen">Redis Documentation: LLEN</a> */ default Mono<Long> lLen(ByteBuffer key) { Assert.notNull(key, "Key must not be null!"); return lLen(Mono.just(new KeyCommand(key))).next().map(NumericResponse::getOutput); }
/** * Get the length of the value stored at {@literal key}. * * @param key must not be {@literal null}. * @return * @see <a href="http://redis.io/commands/strlen">Redis Documentation: STRLEN</a> */ default Mono<Long> strLen(ByteBuffer key) { Assert.notNull(key, "Key must not be null!"); return strLen(Mono.just(new KeyCommand(key))).next().map(NumericResponse::getOutput); }
/** * Get single element stored at {@literal key}. * * @param key must not be {@literal null}. * @return {@link Mono#empty()} in case {@literal key} does not exist. * @see <a href="http://redis.io/commands/get">Redis Documentation: GET</a> */ default Mono<ByteBuffer> get(ByteBuffer key) { Assert.notNull(key, "Key must not be null!"); return get(Mono.just(new KeyCommand(key))).next().filter(CommandResponse::isPresent) .map(CommandResponse::getOutput); }
/** * Get all elements of set at {@literal key}. * * @param key must not be {@literal null}. * @return * @see <a href="http://redis.io/commands/smembers">Redis Documentation: SMEMBERS</a> */ default Flux<ByteBuffer> sMembers(ByteBuffer key) { Assert.notNull(key, "Key must not be null!"); return sMembers(Mono.just(new KeyCommand(key))).flatMap(CommandResponse::getOutput); }
/** * Get size of set at {@literal key}. * * @param key must not be {@literal null}. * @return * @see <a href="http://redis.io/commands/scard">Redis Documentation: SCARD</a> */ default Mono<Long> sCard(ByteBuffer key) { Assert.notNull(key, "Key must not be null!"); return sCard(Mono.just(new KeyCommand(key))).next().map(NumericResponse::getOutput); }
/** * Get the time to live for {@code key} in milliseconds. * * @param key must not be {@literal null}. * @return * @see <a href="http://redis.io/commands/ttl">Redis Documentation: TTL</a> */ default Mono<Long> pTtl(ByteBuffer key) { Assert.notNull(key, "Key must not be null!"); return pTtl(Mono.just(new KeyCommand(key))).next().map(NumericResponse::getOutput); }
/** * Get the time to live for {@code key} in seconds. * * @param key must not be {@literal null}. * @return * @see <a href="http://redis.io/commands/ttl">Redis Documentation: TTL</a> */ default Mono<Long> ttl(ByteBuffer key) { Assert.notNull(key, "Key must not be null!"); return ttl(Mono.just(new KeyCommand(key))).next().map(NumericResponse::getOutput); }
/** * Get key set (fields) of hash at {@literal key}. * * @param key must not be {@literal null}. * @return * @see <a href="http://redis.io/commands/hkeys">Redis Documentation: HKEYS</a> */ default Flux<ByteBuffer> hKeys(ByteBuffer key) { Assert.notNull(key, "Key must not be null!"); return hKeys(Mono.just(new KeyCommand(key))).flatMap(CommandResponse::getOutput); }
/** * Delete {@literal key}. * * @param key must not be {@literal null}. * @return * @see <a href="http://redis.io/commands/del">Redis Documentation: DEL</a> */ default Mono<Long> del(ByteBuffer key) { Assert.notNull(key, "Key must not be null!"); return del(Mono.just(new KeyCommand(key))).next().map(NumericResponse::getOutput); }
/** * Determine if given {@literal key} exists. * * @param key must not be {@literal null}. * @return * @see <a href="http://redis.io/commands/exists">Redis Documentation: EXISTS</a> */ default Mono<Boolean> exists(ByteBuffer key) { Assert.notNull(key, "Key must not be null!"); return exists(Mono.just(new KeyCommand(key))).next().map(BooleanResponse::getOutput); }
/** * Get entire hash stored at {@literal key}. * * @param key must not be {@literal null}. * @return * @see <a href="http://redis.io/commands/hgetall">Redis Documentation: HGETALL</a> */ default Flux<Map.Entry<ByteBuffer, ByteBuffer>> hGetAll(ByteBuffer key) { Assert.notNull(key, "Key must not be null!"); return hGetAll(Mono.just(new KeyCommand(key))).flatMap(CommandResponse::getOutput); }
/** * Get entry set (values) of hash at {@literal key}. * * @param key must not be {@literal null}. * @return * @see <a href="http://redis.io/commands/hvals">Redis Documentation: HVALS</a> */ default Flux<ByteBuffer> hVals(ByteBuffer key) { Assert.notNull(key, "Key must not be null!"); return hVals(Mono.just(new KeyCommand(key))).flatMap(CommandResponse::getOutput); }
/** * Get the size of the stream stored at {@literal key}. * * @param key must not be {@literal null}. * @return {@link Mono} emitting the length of the stream. * @see <a href="http://redis.io/commands/xlen">Redis Documentation: XLEN</a> */ default Mono<Long> xLen(ByteBuffer key) { Assert.notNull(key, "Key must not be null!"); return xLen(Mono.just(new KeyCommand(key))).next().map(NumericResponse::getOutput); }
/** * Remove the expiration from given {@code key}. * * @param key must not be {@literal null}. * @return * @see <a href="http://redis.io/commands/persist">Redis Documentation: PERSIST</a> */ default Mono<Boolean> persist(ByteBuffer key) { Assert.notNull(key, "Key must not be null!"); return persist(Mono.just(new KeyCommand(key))).next().map(BooleanResponse::getOutput); }
/** * Determine the type stored at {@literal key}. * * @param key must not be {@literal null}. * @return * @see <a href="http://redis.io/commands/type">Redis Documentation: TYPE</a> */ default Mono<DataType> type(ByteBuffer key) { Assert.notNull(key, "Key must not be null!"); return type(Mono.just(new KeyCommand(key))).next().map(CommandResponse::getOutput); }
/** * Increment value of {@literal key} by 1. * * @param key must not be {@literal null}. * @return * @see <a href="http://redis.io/commands/incr">Redis Documentation: INCR</a> */ default Mono<Long> incr(ByteBuffer key) { Assert.notNull(key, "Key must not be null!"); return incr(Mono.just(new KeyCommand(key))).next().map(NumericResponse::getOutput); }