@Override public Mono<Boolean> delete(H key) { Assert.notNull(key, "Key must not be null!"); return template.createMono(connection -> connection.keyCommands().del(rawKey(key))).map(l -> l != 0); }
@Override public Mono<Boolean> delete(K key) { Assert.notNull(key, "Key must not be null!"); return template.createMono(connection -> connection.keyCommands().del(rawKey(key))).map(l -> l != 0); }
@Override public Mono<Boolean> delete(K key) { Assert.notNull(key, "Key must not be null!"); return template.createMono(connection -> connection.keyCommands().del(rawKey(key))).map(l -> l != 0); }
@Override public Mono<Boolean> delete(K key) { Assert.notNull(key, "Key must not be null!"); return template.createMono(connection -> connection.keyCommands().del(rawKey(key))).map(l -> l != 0); }
@Override public Mono<Boolean> delete(K key) { Assert.notNull(key, "Key must not be null!"); return template.createMono(connection -> connection.keyCommands().del(rawKey(key))).map(l -> l != 0); }
@Override public Mono<Boolean> delete(K key) { Assert.notNull(key, "Key must not be null!"); return template.createMono(connection -> connection.keyCommands().del(rawKey(key))).map(l -> l != 0); }
@Override public Mono<Long> increment(K key, long delta) { Assert.notNull(key, "Key must not be null!"); return template.createMono(connection -> connection.numberCommands().incrBy(rawKey(key), delta)); }
@Override @SafeVarargs public final Mono<Long> remove(K key, V... members) { Assert.notNull(key, "Key must not be null!"); Assert.notEmpty(members, "Members must not be null or empty!"); Assert.noNullElements(members, "Members must not contain null elements!"); return template.createMono(connection -> Flux.fromArray(members) // .map(this::rawValue) // .collectList() // .flatMap(serialized -> connection.zSetCommands().zRem(rawKey(key), serialized))); }
@Override public Mono<Boolean> hasKey(K key) { Assert.notNull(key, "Key must not be null!"); return createMono(connection -> connection.keyCommands().exists(rawKey(key))); }
@Override public Mono<DataType> type(K key) { Assert.notNull(key, "Key must not be null!"); return createMono(connection -> connection.keyCommands().type(rawKey(key))); }
@Override public Mono<Boolean> move(K key, int dbIndex) { Assert.notNull(key, "Key must not be null!"); return createMono(connection -> connection.keyCommands().move(rawKey(key), dbIndex)); }
@Override @SafeVarargs public final Mono<Long> unlink(K... keys) { Assert.notNull(keys, "Keys must not be null!"); Assert.notEmpty(keys, "Keys must not be empty!"); Assert.noNullElements(keys, "Keys must not contain null elements!"); if (keys.length == 1) { return createMono(connection -> connection.keyCommands().unlink(rawKey(keys[0]))); } Mono<List<ByteBuffer>> listOfKeys = Flux.fromArray(keys).map(this::rawKey).collectList(); return createMono(connection -> listOfKeys.flatMap(rawKeys -> connection.keyCommands().mUnlink(rawKeys))); }
@Override public Mono<Boolean> persist(K key) { Assert.notNull(key, "Key must not be null!"); return createMono(connection -> connection.keyCommands().persist(rawKey(key))); }
@Override public Mono<Long> decrement(K key) { Assert.notNull(key, "Key must not be null!"); return template.createMono(connection -> connection.numberCommands().decr(rawKey(key))); }
@Override public Mono<Boolean> rename(K oldKey, K newKey) { Assert.notNull(oldKey, "Old key must not be null!"); Assert.notNull(newKey, "New Key must not be null!"); return createMono(connection -> connection.keyCommands().rename(rawKey(oldKey), rawKey(newKey))); }
@Override public Mono<Long> increment(H key, HK hashKey, long delta) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(hashKey, "Hash key must not be null!"); return template.createMono(connection -> connection // .numberCommands() // .hIncrBy(rawKey(key), rawHashKey(hashKey), delta)); }
@Override public Mono<Double> increment(H key, HK hashKey, double delta) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(hashKey, "Hash key must not be null!"); return template.createMono(connection -> connection // .numberCommands() // .hIncrBy(rawKey(key), rawHashKey(hashKey), delta)); }
@Override public Mono<Boolean> expireAt(K key, Instant expireAt) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(expireAt, "Expire at must not be null!"); if (expireAt.getNano() == 0) { return createMono(connection -> connection.keyCommands() // .expireAt(rawKey(key), expireAt)); } return createMono(connection -> connection.keyCommands().pExpireAt(rawKey(key), expireAt)); }
@Override public Mono<Boolean> expire(K key, Duration timeout) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(timeout, "Timeout must not be null!"); if (timeout.getNano() == 0) { return createMono(connection -> connection.keyCommands() // .expire(rawKey(key), timeout)); } return createMono(connection -> connection.keyCommands().pExpire(rawKey(key), timeout)); }
@Override public Mono<Long> convertAndSend(String destination, V message) { Assert.hasText(destination, "Destination channel must not be empty!"); Assert.notNull(message, "Message must not be null!"); return createMono(connection -> connection.pubSubCommands().publish( getSerializationContext().getStringSerializationPair().write(destination), getSerializationContext().getValueSerializationPair().write(message))); }