private <T> Flux<T> createFlux(Function<ReactiveStreamCommands, Publisher<T>> function) { Assert.notNull(function, "Function must not be null!"); return template.createFlux(connection -> function.apply(connection.streamCommands())); }
private <T> Flux<T> createFlux(Function<ReactiveSetCommands, Publisher<T>> function) { Assert.notNull(function, "Function must not be null!"); return template.createFlux(connection -> function.apply(connection.setCommands())); }
private <T> Flux<T> createFlux(Function<ReactiveZSetCommands, Publisher<T>> function) { Assert.notNull(function, "Function must not be null!"); return template.createFlux(connection -> function.apply(connection.zSetCommands())); }
private <T> Flux<T> createFlux(Function<ReactiveListCommands, Publisher<T>> function) { Assert.notNull(function, "Function must not be null!"); return template.createFlux(connection -> function.apply(connection.listCommands())); }
private <T> Flux<T> createFlux(Function<ReactiveHashCommands, Publisher<T>> function) { Assert.notNull(function, "Function must not be null!"); return template.createFlux(connection -> function.apply(connection.hashCommands())); }
private <T> Flux<T> createFlux(Function<ReactiveGeoCommands, Publisher<T>> function) { Assert.notNull(function, "Function must not be null!"); return template.createFlux(connection -> function.apply(connection.geoCommands())); }
@Override public Flux<K> scan(ScanOptions options) { Assert.notNull(options, "ScanOptions must not be null!"); return createFlux(connection -> connection.keyCommands().scan(options)) // .map(this::readKey); }
@Override public Flux<K> keys(K pattern) { Assert.notNull(pattern, "Pattern must not be null!"); return createFlux(connection -> connection.keyCommands().keys(rawKey(pattern))) // .flatMap(Flux::fromIterable) // .map(this::readKey); }
@Override public Mono<Long> delete(Publisher<K> keys) { Assert.notNull(keys, "Keys must not be null!"); return createFlux(connection -> connection.keyCommands() // .mDel(Flux.from(keys).map(this::rawKey).buffer(128)) // .map(CommandResponse::getOutput)) // .collect(Collectors.summingLong(value -> value)); }
@Override public Mono<Long> unlink(Publisher<K> keys) { Assert.notNull(keys, "Keys must not be null!"); return createFlux(connection -> connection.keyCommands() // .mUnlink(Flux.from(keys).map(this::rawKey).buffer(128)) // .map(CommandResponse::getOutput)) // .collect(Collectors.summingLong(value -> value)); }
private <T> Flux<T> createFlux(Function<ReactiveSetCommands, Publisher<T>> function) { Assert.notNull(function, "Function must not be null!"); return template.createFlux(connection -> function.apply(connection.setCommands())); }
private <T> Flux<T> createFlux(Function<ReactiveListCommands, Publisher<T>> function) { Assert.notNull(function, "Function must not be null!"); return template.createFlux(connection -> function.apply(connection.listCommands())); }
@Override public Flux<K> scan(ScanOptions options) { Assert.notNull(options, "ScanOptions must not be null!"); return createFlux(connection -> connection.keyCommands().scan(options)) // .map(this::readKey); }
@Override public Flux<K> scan(ScanOptions options) { Assert.notNull(options, "ScanOptions must not be null!"); return createFlux(connection -> connection.keyCommands().scan(options)) // .map(this::readKey); }
@Override public Flux<K> keys(K pattern) { Assert.notNull(pattern, "Pattern must not be null!"); return createFlux(connection -> connection.keyCommands().keys(rawKey(pattern))) // .flatMap(Flux::fromIterable) // .map(this::readKey); }
@Override public Flux<K> keys(K pattern) { Assert.notNull(pattern, "Pattern must not be null!"); return createFlux(connection -> connection.keyCommands().keys(rawKey(pattern))) // .flatMap(Flux::fromIterable) // .map(this::readKey); }
@Override public Mono<Long> delete(Publisher<K> keys) { Assert.notNull(keys, "Keys must not be null!"); return createFlux(connection -> connection.keyCommands() // .mDel(Flux.from(keys).map(this::rawKey).buffer(128)) // .map(CommandResponse::getOutput)) // .collect(Collectors.summingLong(value -> value)); }
@Override public Mono<Long> unlink(Publisher<K> keys) { Assert.notNull(keys, "Keys must not be null!"); return createFlux(connection -> connection.keyCommands() // .mUnlink(Flux.from(keys).map(this::rawKey).buffer(128)) // .map(CommandResponse::getOutput)) // .collect(Collectors.summingLong(value -> value)); }
@Override public Mono<Long> delete(Publisher<K> keys) { Assert.notNull(keys, "Keys must not be null!"); return createFlux(connection -> connection.keyCommands() // .mDel(Flux.from(keys).map(this::rawKey).buffer(128)) // .map(CommandResponse::getOutput)) // .collect(Collectors.summingLong(value -> value)); }
@Override public Mono<Long> unlink(Publisher<K> keys) { Assert.notNull(keys, "Keys must not be null!"); return createFlux(connection -> connection.keyCommands() // .mUnlink(Flux.from(keys).map(this::rawKey).buffer(128)) // .map(CommandResponse::getOutput)) // .collect(Collectors.summingLong(value -> value)); }