@Override public Flux<CommandResponse<KeyCommand, Flux<Map.Entry<ByteBuffer, ByteBuffer>>>> hGetAll( Publisher<KeyCommand> commands) { return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Mono<Map<ByteBuffer, ByteBuffer>> result = cmd.hgetall(command.getKey()); return Mono.just(new CommandResponse<>(command, result.flatMapMany(v -> Flux.fromStream(v.entrySet().stream())))); })); }
@Override public Flux<CommandResponse<KeyCommand, DataType>> type(Publisher<KeyCommand> commands) { return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); return cmd.type(command.getKey()).map(LettuceConverters::toDataType) .map(respValue -> new CommandResponse<>(command, respValue)); })); }
@Override public Flux<BooleanResponse<KeyCommand>> exists(Publisher<KeyCommand> commands) { return connection.execute(cmd -> Flux.from(commands).concatMap((command) -> { Assert.notNull(command.getKey(), "Key must not be null!"); return cmd.exists(command.getKey()).map(LettuceConverters.longToBooleanConverter()::convert) .map((value) -> new BooleanResponse<>(command, value)); })); }
@Override public Flux<CommandResponse<KeyCommand, Flux<ByteBuffer>>> hKeys(Publisher<KeyCommand> commands) { return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Flux<ByteBuffer> result = cmd.hkeys(command.getKey()); return Mono.just(new CommandResponse<>(command, result)); })); }
@Override public Flux<CommandResponse<KeyCommand, Flux<ByteBuffer>>> sMembers(Publisher<KeyCommand> commands) { return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Flux<ByteBuffer> result = cmd.smembers(command.getKey()); return Mono.just(new CommandResponse<>(command, result)); })); }
@Override public Flux<NumericResponse<KeyCommand, Long>> unlink(Publisher<KeyCommand> commands) { return connection.execute(cmd -> Flux.from(commands).concatMap((command) -> { Assert.notNull(command.getKey(), "Key must not be null!"); return cmd.unlink(command.getKey()).map((value) -> new NumericResponse<>(command, value)); })); }
@Override public Flux<NumericResponse<KeyCommand, Long>> del(Publisher<KeyCommand> commands) { return connection.execute(cmd -> Flux.from(commands).concatMap((command) -> { Assert.notNull(command.getKey(), "Key must not be null!"); return cmd.del(command.getKey()).map((value) -> new NumericResponse<>(command, value)); })); }
@Override public Flux<NumericResponse<KeyCommand, Long>> ttl(Publisher<KeyCommand> commands) { return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); return cmd.ttl(command.getKey()).map(value -> new NumericResponse<>(command, value)); })); }
@Override public Flux<NumericResponse<KeyCommand, Long>> strLen(Publisher<KeyCommand> commands) { return connection.execute(cmd -> { return Flux.from(commands).concatMap(command -> { return cmd.strlen(command.getKey()).map(respValue -> new NumericResponse<>(command, respValue)); }); }); }
@Override public Flux<ByteBufferResponse<KeyCommand>> get(Publisher<KeyCommand> commands) { return connection.execute(cmd -> Flux.from(commands).concatMap((command) -> { Assert.notNull(command.getKey(), "Key must not be null!"); return cmd.get(command.getKey()).map((value) -> new ByteBufferResponse<>(command, value)) .defaultIfEmpty(new AbsentByteBufferResponse<>(command)); })); }
@Override public Flux<NumericResponse<KeyCommand, Long>> incr(Publisher<KeyCommand> commands) { return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); return cmd.incr(command.getKey()).map(value -> new NumericResponse<>(command, value)); })); }
@Override public Flux<NumericResponse<KeyCommand, Long>> lLen(Publisher<KeyCommand> commands) { return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); return cmd.llen(command.getKey()).map(value -> new NumericResponse<>(command, value)); })); }
@Override public Flux<BooleanResponse<KeyCommand>> persist(Publisher<KeyCommand> commands) { return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); return cmd.persist(command.getKey()).map(value -> new BooleanResponse<>(command, value)); })); }
@Override public Flux<NumericResponse<KeyCommand, Long>> zCard(Publisher<KeyCommand> commands) { return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); return cmd.zcard(command.getKey()).map(value -> new NumericResponse<>(command, value)); })); }
@Override public Flux<CommandResponse<KeyCommand, Flux<ByteBuffer>>> hVals(Publisher<KeyCommand> commands) { return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Flux<ByteBuffer> result = cmd.hvals(command.getKey()); return Mono.just(new CommandResponse<>(command, result)); })); }
@Override public Flux<NumericResponse<KeyCommand, Long>> hLen(Publisher<KeyCommand> commands) { return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Command.getKey() must not be null!"); return cmd.hlen(command.getKey()).map(value -> new NumericResponse<>(command, value)); })); }
@Override public Flux<NumericResponse<KeyCommand, Long>> pTtl(Publisher<KeyCommand> commands) { return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); return cmd.pttl(command.getKey()).map(value -> new NumericResponse<>(command, value)); })); }
@Override public Flux<NumericResponse<KeyCommand, Long>> decr(Publisher<KeyCommand> commands) { return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); return cmd.decr(command.getKey()).map(value -> new NumericResponse<>(command, value)); })); }
@Override public Flux<NumericResponse<KeyCommand, Long>> xLen(Publisher<KeyCommand> commands) { return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); return cmd.xlen(command.getKey()).map(value -> new NumericResponse<>(command, value)); })); }
@Override public Flux<NumericResponse<KeyCommand, Long>> sCard(Publisher<KeyCommand> commands) { return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); return cmd.scard(command.getKey()).map(value -> new NumericResponse<>(command, value)); })); }