Interface ReactiveKeyCommands
- All Known Subinterfaces:
- ReactiveClusterKeyCommands
public interface ReactiveKeyCommands
Redis Key commands executed using reactive infrastructure.
- Since:
- 2.0
- Author:
- Christoph Strobl, Mark Paluch
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic classMOVEcommand parameters.static classEXPIREAT/PEXPIREATcommand parameters.static classEXPIRE/PEXPIREcommand parameters.static classMOVEcommand parameters.static classRENAMEcommand parameters.
- 
Method SummaryModifier and TypeMethodDescriptiondefault reactor.core.publisher.Mono<Boolean>copy(ByteBuffer sourceKey, ByteBuffer targetKey, boolean replace) Copy givenkeyto a targetkey.reactor.core.publisher.Flux<ReactiveRedisConnection.BooleanResponse<ReactiveKeyCommands.CopyCommand>>copy(org.reactivestreams.Publisher<ReactiveKeyCommands.CopyCommand> commands) Copy keys one-by-one.default reactor.core.publisher.Mono<Long>del(ByteBuffer key) Delete key.reactor.core.publisher.Flux<ReactiveRedisConnection.NumericResponse<ReactiveRedisConnection.KeyCommand,Long>> del(org.reactivestreams.Publisher<ReactiveRedisConnection.KeyCommand> keys) Delete keys one by one.reactor.core.publisher.Mono<ValueEncoding>encodingOf(ByteBuffer key) Get the type of internal representation used for storing the value at the givenkey.default reactor.core.publisher.Mono<Boolean>exists(ByteBuffer key) Determine if given key exists.reactor.core.publisher.Flux<ReactiveRedisConnection.BooleanResponse<ReactiveRedisConnection.KeyCommand>>exists(org.reactivestreams.Publisher<ReactiveRedisConnection.KeyCommand> keys) Determine if given key exists.default reactor.core.publisher.Mono<Boolean>expire(ByteBuffer key, Duration timeout) Set time to live for givenkeyin seconds.reactor.core.publisher.Flux<ReactiveRedisConnection.BooleanResponse<ReactiveKeyCommands.ExpireCommand>>expire(org.reactivestreams.Publisher<ReactiveKeyCommands.ExpireCommand> commands) Expire keys one by one.default reactor.core.publisher.Mono<Boolean>expireAt(ByteBuffer key, Instant expireAt) Set the expiration for givenkeyas a UNIX timestamp.reactor.core.publisher.Flux<ReactiveRedisConnection.BooleanResponse<ReactiveKeyCommands.ExpireAtCommand>>expireAt(org.reactivestreams.Publisher<ReactiveKeyCommands.ExpireAtCommand> commands) Set one-by-one the expiration for givenkeyas a UNIX timestamp.reactor.core.publisher.Mono<Duration>idletime(ByteBuffer key) Get theDurationsince the object stored at the givenkeyis idle.default reactor.core.publisher.Mono<List<ByteBuffer>>keys(ByteBuffer pattern) Retrieve all keys matching the given pattern viaKEYScommand.reactor.core.publisher.Flux<ReactiveRedisConnection.MultiValueResponse<ByteBuffer,ByteBuffer>> keys(org.reactivestreams.Publisher<ByteBuffer> patterns) Find all keys matching the given pattern.
 It is recommended to usescan(ScanOptions)to iterate over the keyspace askeys(Publisher)is a non-interruptible and expensive Redis operation.default reactor.core.publisher.Mono<Long>mDel(List<ByteBuffer> keys) Delete multiple keys one in one batch.reactor.core.publisher.Flux<ReactiveRedisConnection.NumericResponse<List<ByteBuffer>,Long>> mDel(org.reactivestreams.Publisher<List<ByteBuffer>> keys) Delete multiple keys in batches.default reactor.core.publisher.Mono<Boolean>move(ByteBuffer key, int database) Move givenkeyto database withindex.reactor.core.publisher.Flux<ReactiveRedisConnection.BooleanResponse<ReactiveKeyCommands.MoveCommand>>move(org.reactivestreams.Publisher<ReactiveKeyCommands.MoveCommand> commands) Move keys one-by-one between databases.default reactor.core.publisher.Mono<Long>mUnlink(List<ByteBuffer> keys) Unlink thekeysfrom the keyspace.reactor.core.publisher.Flux<ReactiveRedisConnection.NumericResponse<List<ByteBuffer>,Long>> mUnlink(org.reactivestreams.Publisher<List<ByteBuffer>> keys) Unlink thekeysfrom the keyspace.default reactor.core.publisher.Mono<Boolean>persist(ByteBuffer key) Remove the expiration from givenkey.reactor.core.publisher.Flux<ReactiveRedisConnection.BooleanResponse<ReactiveRedisConnection.KeyCommand>>persist(org.reactivestreams.Publisher<ReactiveRedisConnection.KeyCommand> commands) Remove one-by-one the expiration from givenkey.default reactor.core.publisher.Mono<Boolean>pExpire(ByteBuffer key, Duration timeout) Set time to live for givenkeyin milliseconds.reactor.core.publisher.Flux<ReactiveRedisConnection.BooleanResponse<ReactiveKeyCommands.ExpireCommand>>pExpire(org.reactivestreams.Publisher<ReactiveKeyCommands.ExpireCommand> commands) Expire keys one by one.default reactor.core.publisher.Mono<Boolean>pExpireAt(ByteBuffer key, Instant expireAt) Set the expiration for givenkeyas a UNIX timestamp.reactor.core.publisher.Flux<ReactiveRedisConnection.BooleanResponse<ReactiveKeyCommands.ExpireAtCommand>>pExpireAt(org.reactivestreams.Publisher<ReactiveKeyCommands.ExpireAtCommand> commands) Set one-by-one the expiration for givenkeyas a UNIX timestamp in milliseconds.default reactor.core.publisher.Mono<Long>pTtl(ByteBuffer key) Get the time to live forkeyin milliseconds.reactor.core.publisher.Flux<ReactiveRedisConnection.NumericResponse<ReactiveRedisConnection.KeyCommand,Long>> pTtl(org.reactivestreams.Publisher<ReactiveRedisConnection.KeyCommand> commands) Get one-by-one the time to live for keys.reactor.core.publisher.Mono<ByteBuffer>Return a random key from the keyspace.reactor.core.publisher.Mono<Long>refcount(ByteBuffer key) Get the number of references of the value associated with the specifiedkey.default reactor.core.publisher.Mono<Boolean>rename(ByteBuffer oldKey, ByteBuffer newKey) Rename key oldKey to newKey.reactor.core.publisher.Flux<ReactiveRedisConnection.BooleanResponse<ReactiveKeyCommands.RenameCommand>>rename(org.reactivestreams.Publisher<ReactiveKeyCommands.RenameCommand> command) Rename key oldKey to newKey.default reactor.core.publisher.Mono<Boolean>renameNX(ByteBuffer key, ByteBuffer newKey) Rename key oldKey to newKey only if newKey does not exist.reactor.core.publisher.Flux<ReactiveRedisConnection.BooleanResponse<ReactiveKeyCommands.RenameCommand>>renameNX(org.reactivestreams.Publisher<ReactiveKeyCommands.RenameCommand> command) Rename key oldKey to newKey only if newKey does not exist.default reactor.core.publisher.Flux<ByteBuffer>scan()Use aFluxto iterate over keys.default reactor.core.publisher.Flux<ByteBuffer>scan(KeyScanOptions options) Use aFluxto iterate over keys.reactor.core.publisher.Flux<ByteBuffer>scan(ScanOptions options) Use aFluxto iterate over keys.default reactor.core.publisher.Mono<Long>touch(Collection<ByteBuffer> keys) Alter the last access time of givenkey(s).reactor.core.publisher.Flux<ReactiveRedisConnection.NumericResponse<Collection<ByteBuffer>,Long>> touch(org.reactivestreams.Publisher<Collection<ByteBuffer>> keys) Alter the last access time of givenkey(s).default reactor.core.publisher.Mono<Long>ttl(ByteBuffer key) Get the time to live forkeyin seconds.reactor.core.publisher.Flux<ReactiveRedisConnection.NumericResponse<ReactiveRedisConnection.KeyCommand,Long>> ttl(org.reactivestreams.Publisher<ReactiveRedisConnection.KeyCommand> commands) Get one-by-one the time to live for keys.default reactor.core.publisher.Mono<DataType>type(ByteBuffer key) Determine the type stored at key.reactor.core.publisher.Flux<ReactiveRedisConnection.CommandResponse<ReactiveRedisConnection.KeyCommand,DataType>> type(org.reactivestreams.Publisher<ReactiveRedisConnection.KeyCommand> keys) Determine the type stored at key.default reactor.core.publisher.Mono<Long>unlink(ByteBuffer key) Unlink thekeyfrom the keyspace.reactor.core.publisher.Flux<ReactiveRedisConnection.NumericResponse<ReactiveRedisConnection.KeyCommand,Long>> unlink(org.reactivestreams.Publisher<ReactiveRedisConnection.KeyCommand> keys) Unlink thekeyfrom the keyspace.
- 
Method Details- 
copydefault reactor.core.publisher.Mono<Boolean> copy(ByteBuffer sourceKey, ByteBuffer targetKey, boolean replace) Copy givenkeyto a targetkey.- Parameters:
- sourceKey- must not be null.
- targetKey- must not be null.
- replace- whether to replace existing keys.
- Returns:
- Since:
- 2.6
- See Also:
 
- 
copyreactor.core.publisher.Flux<ReactiveRedisConnection.BooleanResponse<ReactiveKeyCommands.CopyCommand>> copy(org.reactivestreams.Publisher<ReactiveKeyCommands.CopyCommand> commands) Copy keys one-by-one.- Parameters:
- commands- must not be null.
- Returns:
- Fluxof- ReactiveRedisConnection.BooleanResponseholding the key to move along with the copy result.
- Since:
- 2.6
- See Also:
 
- 
existsDetermine if given key exists.- Parameters:
- key- must not be null.
- Returns:
- See Also:
 
- 
existsreactor.core.publisher.Flux<ReactiveRedisConnection.BooleanResponse<ReactiveRedisConnection.KeyCommand>> exists(org.reactivestreams.Publisher<ReactiveRedisConnection.KeyCommand> keys) Determine if given key exists.- Parameters:
- keys- must not be null.
- Returns:
- See Also:
 
- 
typeDetermine the type stored at key.- Parameters:
- key- must not be null.
- Returns:
- See Also:
 
- 
typereactor.core.publisher.Flux<ReactiveRedisConnection.CommandResponse<ReactiveRedisConnection.KeyCommand,DataType>> type(org.reactivestreams.Publisher<ReactiveRedisConnection.KeyCommand> keys) Determine the type stored at key.- Parameters:
- keys- must not be null.
- Returns:
- See Also:
 
- 
touchAlter the last access time of givenkey(s).- Parameters:
- keys- must not be null.
- Returns:
- Monoemitting the number of keys touched.
- Since:
- 2.1
- See Also:
 
- 
touchreactor.core.publisher.Flux<ReactiveRedisConnection.NumericResponse<Collection<ByteBuffer>,Long>> touch(org.reactivestreams.Publisher<Collection<ByteBuffer>> keys) Alter the last access time of givenkey(s).- Parameters:
- keys- must not be null.
- Returns:
- Since:
- 2.1
- See Also:
 
- 
keysRetrieve all keys matching the given pattern viaKEYScommand.IMPORTANT: This command is non-interruptible and scans the entire keyspace which may cause performance issues. Consider scan(ScanOptions)for large datasets.- Parameters:
- pattern- must not be null.
- Returns:
- See Also:
 
- 
keysreactor.core.publisher.Flux<ReactiveRedisConnection.MultiValueResponse<ByteBuffer,ByteBuffer>> keys(org.reactivestreams.Publisher<ByteBuffer> patterns) Find all keys matching the given pattern.
 It is recommended to usescan(ScanOptions)to iterate over the keyspace askeys(Publisher)is a non-interruptible and expensive Redis operation.- Parameters:
- patterns- must not be null.
- Returns:
- See Also:
 
- 
scanUse aFluxto iterate over keys. The resultingFluxacts as a cursor and issuesSCANcommands itself as long as the subscriber signals demand.- Returns:
- never null.
- Since:
- 2.1
- See Also:
 
- 
scanUse aFluxto iterate over keys. The resultingFluxacts as a cursor and issuesSCANcommands itself as long as the subscriber signals demand.- Parameters:
- options- must not be null.
- Returns:
- the Fluxemittingkeysone by one.
- Throws:
- IllegalArgumentException- when options is null.
- Since:
- 2.6
- See Also:
 
- 
scanUse aFluxto iterate over keys. The resultingFluxacts as a cursor and issuesSCANcommands itself as long as the subscriber signals demand.- Parameters:
- options- must not be null.
- Returns:
- the Fluxemittingkeysone by one.
- Throws:
- IllegalArgumentException- when options is null.
- Since:
- 2.1
- See Also:
 
- 
randomKeyreactor.core.publisher.Mono<ByteBuffer> randomKey()Return a random key from the keyspace.- Returns:
- See Also:
 
- 
renameRename key oldKey to newKey.- Parameters:
- oldKey- must not be null.
- newKey- must not be null.
- Returns:
- See Also:
 
- 
renamereactor.core.publisher.Flux<ReactiveRedisConnection.BooleanResponse<ReactiveKeyCommands.RenameCommand>> rename(org.reactivestreams.Publisher<ReactiveKeyCommands.RenameCommand> command) Rename key oldKey to newKey.- Parameters:
- command- must not be null.
- Returns:
- See Also:
 
- 
renameNXRename key oldKey to newKey only if newKey does not exist.- Parameters:
- key- must not be null.
- newKey- must not be null.
- Returns:
- See Also:
 
- 
renameNXreactor.core.publisher.Flux<ReactiveRedisConnection.BooleanResponse<ReactiveKeyCommands.RenameCommand>> renameNX(org.reactivestreams.Publisher<ReactiveKeyCommands.RenameCommand> command) Rename key oldKey to newKey only if newKey does not exist.- Parameters:
- command- must not be null.
- Returns:
- See Also:
 
- 
delDelete key.- Parameters:
- key- must not be null.
- Returns:
- See Also:
 
- 
delreactor.core.publisher.Flux<ReactiveRedisConnection.NumericResponse<ReactiveRedisConnection.KeyCommand,Long>> del(org.reactivestreams.Publisher<ReactiveRedisConnection.KeyCommand> keys) Delete keys one by one.- Parameters:
- keys- must not be null.
- Returns:
- Fluxof- ReactiveRedisConnection.NumericResponseholding the key removed along with the deletion result.
- See Also:
 
- 
mDelDelete multiple keys one in one batch.- Parameters:
- keys- must not be null.
- Returns:
- See Also:
 
- 
mDelreactor.core.publisher.Flux<ReactiveRedisConnection.NumericResponse<List<ByteBuffer>,Long>> mDel(org.reactivestreams.Publisher<List<ByteBuffer>> keys) Delete multiple keys in batches.- Parameters:
- keys- must not be null.
- Returns:
- Fluxof- ReactiveRedisConnection.NumericResponseholding the keys removed along with the deletion result.
- See Also:
 
- 
unlinkUnlink thekeyfrom the keyspace. Unlike withdel(ByteBuffer)the actual memory reclaiming here happens asynchronously.- Parameters:
- key- must not be null.
- Returns:
- Since:
- 2.1
- See Also:
 
- 
unlinkreactor.core.publisher.Flux<ReactiveRedisConnection.NumericResponse<ReactiveRedisConnection.KeyCommand,Long>> unlink(org.reactivestreams.Publisher<ReactiveRedisConnection.KeyCommand> keys) Unlink thekeyfrom the keyspace. Unlike withdel(ByteBuffer)the actual memory reclaiming here happens asynchronously.- Parameters:
- keys- must not be null.
- Returns:
- Fluxof- ReactiveRedisConnection.NumericResponseholding the key removed along with the unlink result.
- Since:
- 2.1
- See Also:
 
- 
mUnlinkUnlink thekeysfrom the keyspace. Unlike withmDel(List)the actual memory reclaiming here happens asynchronously.- Parameters:
- keys- must not be null.
- Returns:
- Since:
- 2.1
- See Also:
 
- 
mUnlinkreactor.core.publisher.Flux<ReactiveRedisConnection.NumericResponse<List<ByteBuffer>,Long>> mUnlink(org.reactivestreams.Publisher<List<ByteBuffer>> keys) Unlink thekeysfrom the keyspace. Unlike withmDel(Publisher)the actual memory reclaiming here happens asynchronously.- Parameters:
- keys- must not be null.
- Returns:
- Fluxof- ReactiveRedisConnection.NumericResponseholding the key removed along with the deletion result.
- Since:
- 2.1
- See Also:
 
- 
expireSet time to live for givenkeyin seconds.- Parameters:
- key- must not be null.
- timeout- must not be null.
- Returns:
- See Also:
 
- 
expirereactor.core.publisher.Flux<ReactiveRedisConnection.BooleanResponse<ReactiveKeyCommands.ExpireCommand>> expire(org.reactivestreams.Publisher<ReactiveKeyCommands.ExpireCommand> commands) Expire keys one by one.- Parameters:
- commands- must not be null.
- Returns:
- Fluxof- ReactiveRedisConnection.BooleanResponseholding the key removed along with the expiration result.
- See Also:
 
- 
pExpireSet time to live for givenkeyin milliseconds.- Parameters:
- key- must not be null.
- timeout- must not be null.
- Returns:
- See Also:
 
- 
pExpirereactor.core.publisher.Flux<ReactiveRedisConnection.BooleanResponse<ReactiveKeyCommands.ExpireCommand>> pExpire(org.reactivestreams.Publisher<ReactiveKeyCommands.ExpireCommand> commands) Expire keys one by one.- Parameters:
- commands- must not be null.
- Returns:
- Fluxof- ReactiveRedisConnection.BooleanResponseholding the key removed along with the expiration result.
- See Also:
 
- 
expireAtSet the expiration for givenkeyas a UNIX timestamp.- Parameters:
- key- must not be null.
- expireAt- must not be null.
- Returns:
- See Also:
 
- 
expireAtreactor.core.publisher.Flux<ReactiveRedisConnection.BooleanResponse<ReactiveKeyCommands.ExpireAtCommand>> expireAt(org.reactivestreams.Publisher<ReactiveKeyCommands.ExpireAtCommand> commands) Set one-by-one the expiration for givenkeyas a UNIX timestamp.- Parameters:
- commands- must not be null.
- Returns:
- Fluxof- ReactiveRedisConnection.BooleanResponseholding the key removed along with the expiration result.
- See Also:
 
- 
pExpireAtSet the expiration for givenkeyas a UNIX timestamp.- Parameters:
- key- must not be null.
- expireAt- must not be null.
- Returns:
- See Also:
 
- 
pExpireAtreactor.core.publisher.Flux<ReactiveRedisConnection.BooleanResponse<ReactiveKeyCommands.ExpireAtCommand>> pExpireAt(org.reactivestreams.Publisher<ReactiveKeyCommands.ExpireAtCommand> commands) Set one-by-one the expiration for givenkeyas a UNIX timestamp in milliseconds.- Parameters:
- commands- must not be null.
- Returns:
- Fluxof- ReactiveRedisConnection.BooleanResponseholding the key removed along with the expiration result.
- See Also:
 
- 
persistRemove the expiration from givenkey.- Parameters:
- key- must not be null.
- Returns:
- See Also:
 
- 
persistreactor.core.publisher.Flux<ReactiveRedisConnection.BooleanResponse<ReactiveRedisConnection.KeyCommand>> persist(org.reactivestreams.Publisher<ReactiveRedisConnection.KeyCommand> commands) Remove one-by-one the expiration from givenkey.- Parameters:
- commands- must not be null.
- Returns:
- Fluxof- ReactiveRedisConnection.BooleanResponseholding the key persisted along with the persist result.
- See Also:
 
- 
ttlGet the time to live forkeyin seconds.- Parameters:
- key- must not be null.
- Returns:
- See Also:
 
- 
ttlreactor.core.publisher.Flux<ReactiveRedisConnection.NumericResponse<ReactiveRedisConnection.KeyCommand,Long>> ttl(org.reactivestreams.Publisher<ReactiveRedisConnection.KeyCommand> commands) Get one-by-one the time to live for keys.- Parameters:
- commands- must not be null.
- Returns:
- Fluxof- ReactiveRedisConnection.NumericResponseholding the key along with the time to live result.
- See Also:
 
- 
pTtlGet the time to live forkeyin milliseconds.- Parameters:
- key- must not be null.
- Returns:
- See Also:
 
- 
pTtlreactor.core.publisher.Flux<ReactiveRedisConnection.NumericResponse<ReactiveRedisConnection.KeyCommand,Long>> pTtl(org.reactivestreams.Publisher<ReactiveRedisConnection.KeyCommand> commands) Get one-by-one the time to live for keys.- Parameters:
- commands- must not be null.
- Returns:
- Fluxof- ReactiveRedisConnection.NumericResponseholding the key along with the time to live result.
- See Also:
 
- 
moveMove givenkeyto database withindex.- Parameters:
- key- must not be null.
- Returns:
- See Also:
 
- 
movereactor.core.publisher.Flux<ReactiveRedisConnection.BooleanResponse<ReactiveKeyCommands.MoveCommand>> move(org.reactivestreams.Publisher<ReactiveKeyCommands.MoveCommand> commands) Move keys one-by-one between databases.- Parameters:
- commands- must not be null.
- Returns:
- Fluxof- ReactiveRedisConnection.BooleanResponseholding the key to move along with the move result.
- See Also:
 
- 
encodingOfGet the type of internal representation used for storing the value at the givenkey.- Parameters:
- key- must not be null.
- Returns:
- the MonoemittingValueEncoding.
- Throws:
- IllegalArgumentException- if- keyis null.
- Since:
- 2.1
- See Also:
 
- 
idletimeGet theDurationsince the object stored at the givenkeyis idle.- Parameters:
- key- must not be null.
- Returns:
- the Monoemitting the idletime of the key ofMono.empty()if the key does not exist.
- Throws:
- IllegalArgumentException- if- keyis null.
- Since:
- 2.1
- See Also:
 
- 
refcountGet the number of references of the value associated with the specifiedkey.- Parameters:
- key- must not be null.
- Returns:
- Mono.empty()if key does not exist.
- Throws:
- IllegalArgumentException- if- keyis null.
- Since:
- 2.1
- See Also:
 
 
-