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 Summary
Modifier and TypeInterfaceDescriptionstatic class
MOVE
command parameters.static class
EXPIREAT
/PEXPIREAT
command parameters.static class
EXPIRE
/PEXPIRE
command parameters.static class
MOVE
command parameters.static class
RENAME
command parameters. -
Method Summary
Modifier and TypeMethodDescriptiondefault reactor.core.publisher.Mono<Boolean>
copy
(ByteBuffer sourceKey, ByteBuffer targetKey, boolean replace) Copy givenkey
to 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 givenkey
in 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 givenkey
as 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 givenkey
as a UNIX timestamp.reactor.core.publisher.Mono<Duration>
idletime
(ByteBuffer key) Get theDuration
since the object stored at the givenkey
is idle.default reactor.core.publisher.Mono<List<ByteBuffer>>
keys
(ByteBuffer pattern) Find all keys matching the given pattern.
It is recommended to usescan(ScanOptions)
to iterate over the keyspace askeys(ByteBuffer)
is a non-interruptible and expensive Redis operation.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 givenkey
to 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 thekeys
from the keyspace.reactor.core.publisher.Flux<ReactiveRedisConnection.NumericResponse<List<ByteBuffer>,
Long>> mUnlink
(org.reactivestreams.Publisher<List<ByteBuffer>> keys) Unlink thekeys
from 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 givenkey
in 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 givenkey
as 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 givenkey
as a UNIX timestamp in milliseconds.default reactor.core.publisher.Mono<Long>
pTtl
(ByteBuffer key) Get the time to live forkey
in 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 aFlux
to iterate over keys.default reactor.core.publisher.Flux<ByteBuffer>
scan
(KeyScanOptions options) Use aFlux
to iterate over keys.reactor.core.publisher.Flux<ByteBuffer>
scan
(ScanOptions options) Use aFlux
to 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 forkey
in 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 thekey
from the keyspace.reactor.core.publisher.Flux<ReactiveRedisConnection.NumericResponse<ReactiveRedisConnection.KeyCommand,
Long>> unlink
(org.reactivestreams.Publisher<ReactiveRedisConnection.KeyCommand> keys) Unlink thekey
from the keyspace.
-
Method Details
-
copy
default reactor.core.publisher.Mono<Boolean> copy(ByteBuffer sourceKey, ByteBuffer targetKey, boolean replace) Copy givenkey
to 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:
-
copy
reactor.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:
Flux
ofReactiveRedisConnection.BooleanResponse
holding the key to move along with the copy result.- Since:
- 2.6
- See Also:
-
exists
Determine if given key exists.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
exists
reactor.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:
-
type
Determine the type stored at key.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
type
reactor.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:
-
touch
Alter the last access time of givenkey(s)
.- Parameters:
keys
- must not be null.- Returns:
Mono
emitting the number of keys touched.- Since:
- 2.1
- See Also:
-
touch
reactor.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:
-
keys
Find all keys matching the given pattern.
It is recommended to usescan(ScanOptions)
to iterate over the keyspace askeys(ByteBuffer)
is a non-interruptible and expensive Redis operation.- Parameters:
pattern
- must not be null.- Returns:
- See Also:
-
keys
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.- Parameters:
patterns
- must not be null.- Returns:
- See Also:
-
scan
Use aFlux
to iterate over keys. The resultingFlux
acts as a cursor and issuesSCAN
commands itself as long as the subscriber signals demand.- Returns:
- never null.
- Since:
- 2.1
- See Also:
-
scan
Use aFlux
to iterate over keys. The resultingFlux
acts as a cursor and issuesSCAN
commands itself as long as the subscriber signals demand.- Parameters:
options
- must not be null.- Returns:
- the
Flux
emittingkeys
one by one. - Throws:
IllegalArgumentException
- when options is null.- Since:
- 2.6
- See Also:
-
scan
Use aFlux
to iterate over keys. The resultingFlux
acts as a cursor and issuesSCAN
commands itself as long as the subscriber signals demand.- Parameters:
options
- must not be null.- Returns:
- the
Flux
emittingkeys
one by one. - Throws:
IllegalArgumentException
- when options is null.- Since:
- 2.1
- See Also:
-
randomKey
reactor.core.publisher.Mono<ByteBuffer> randomKey()Return a random key from the keyspace.- Returns:
- See Also:
-
rename
Rename key oldKey to newKey.- Parameters:
oldKey
- must not be null.newKey
- must not be null.- Returns:
- See Also:
-
rename
reactor.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:
-
renameNX
Rename key oldKey to newKey only if newKey does not exist.- Parameters:
key
- must not be null.newKey
- must not be null.- Returns:
- See Also:
-
renameNX
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.- Parameters:
command
- must not be null.- Returns:
- See Also:
-
del
Delete key.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
del
reactor.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:
Flux
ofReactiveRedisConnection.NumericResponse
holding the key removed along with the deletion result.- See Also:
-
mDel
Delete multiple keys one in one batch.- Parameters:
keys
- must not be null.- Returns:
- See Also:
-
mDel
reactor.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:
Flux
ofReactiveRedisConnection.NumericResponse
holding the keys removed along with the deletion result.- See Also:
-
unlink
Unlink thekey
from the keyspace. Unlike withdel(ByteBuffer)
the actual memory reclaiming here happens asynchronously.- Parameters:
key
- must not be null.- Returns:
- Since:
- 2.1
- See Also:
-
unlink
reactor.core.publisher.Flux<ReactiveRedisConnection.NumericResponse<ReactiveRedisConnection.KeyCommand,Long>> unlink(org.reactivestreams.Publisher<ReactiveRedisConnection.KeyCommand> keys) Unlink thekey
from the keyspace. Unlike withdel(ByteBuffer)
the actual memory reclaiming here happens asynchronously.- Parameters:
keys
- must not be null.- Returns:
Flux
ofReactiveRedisConnection.NumericResponse
holding the key removed along with the unlink result.- Since:
- 2.1
- See Also:
-
mUnlink
Unlink thekeys
from the keyspace. Unlike withmDel(List)
the actual memory reclaiming here happens asynchronously.- Parameters:
keys
- must not be null.- Returns:
- Since:
- 2.1
- See Also:
-
mUnlink
reactor.core.publisher.Flux<ReactiveRedisConnection.NumericResponse<List<ByteBuffer>,Long>> mUnlink(org.reactivestreams.Publisher<List<ByteBuffer>> keys) Unlink thekeys
from the keyspace. Unlike withmDel(Publisher)
the actual memory reclaiming here happens asynchronously.- Parameters:
keys
- must not be null.- Returns:
Flux
ofReactiveRedisConnection.NumericResponse
holding the key removed along with the deletion result.- Since:
- 2.1
- See Also:
-
expire
Set time to live for givenkey
in seconds.- Parameters:
key
- must not be null.timeout
- must not be null.- Returns:
- See Also:
-
expire
reactor.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:
Flux
ofReactiveRedisConnection.BooleanResponse
holding the key removed along with the expiration result.- See Also:
-
pExpire
Set time to live for givenkey
in milliseconds.- Parameters:
key
- must not be null.timeout
- must not be null.- Returns:
- See Also:
-
pExpire
reactor.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:
Flux
ofReactiveRedisConnection.BooleanResponse
holding the key removed along with the expiration result.- See Also:
-
expireAt
Set the expiration for givenkey
as a UNIX timestamp.- Parameters:
key
- must not be null.expireAt
- must not be null.- Returns:
- See Also:
-
expireAt
reactor.core.publisher.Flux<ReactiveRedisConnection.BooleanResponse<ReactiveKeyCommands.ExpireAtCommand>> expireAt(org.reactivestreams.Publisher<ReactiveKeyCommands.ExpireAtCommand> commands) Set one-by-one the expiration for givenkey
as a UNIX timestamp.- Parameters:
commands
- must not be null.- Returns:
Flux
ofReactiveRedisConnection.BooleanResponse
holding the key removed along with the expiration result.- See Also:
-
pExpireAt
Set the expiration for givenkey
as a UNIX timestamp.- Parameters:
key
- must not be null.expireAt
- must not be null.- Returns:
- See Also:
-
pExpireAt
reactor.core.publisher.Flux<ReactiveRedisConnection.BooleanResponse<ReactiveKeyCommands.ExpireAtCommand>> pExpireAt(org.reactivestreams.Publisher<ReactiveKeyCommands.ExpireAtCommand> commands) Set one-by-one the expiration for givenkey
as a UNIX timestamp in milliseconds.- Parameters:
commands
- must not be null.- Returns:
Flux
ofReactiveRedisConnection.BooleanResponse
holding the key removed along with the expiration result.- See Also:
-
persist
Remove the expiration from givenkey
.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
persist
reactor.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:
Flux
ofReactiveRedisConnection.BooleanResponse
holding the key persisted along with the persist result.- See Also:
-
ttl
Get the time to live forkey
in seconds.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
ttl
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.- Parameters:
commands
- must not be null.- Returns:
Flux
ofReactiveRedisConnection.NumericResponse
holding the key along with the time to live result.- See Also:
-
pTtl
Get the time to live forkey
in milliseconds.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
pTtl
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.- Parameters:
commands
- must not be null.- Returns:
Flux
ofReactiveRedisConnection.NumericResponse
holding the key along with the time to live result.- See Also:
-
move
Move givenkey
to database withindex
.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
move
reactor.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:
Flux
ofReactiveRedisConnection.BooleanResponse
holding the key to move along with the move result.- See Also:
-
encodingOf
Get the type of internal representation used for storing the value at the givenkey
.- Parameters:
key
- must not be null.- Returns:
- the
Mono
emittingValueEncoding
. - Throws:
IllegalArgumentException
- ifkey
is null.- Since:
- 2.1
- See Also:
-
idletime
Get theDuration
since the object stored at the givenkey
is idle.- Parameters:
key
- must not be null.- Returns:
- the
Mono
emitting the idletime of the key ofMono.empty()
if the key does not exist. - Throws:
IllegalArgumentException
- ifkey
is null.- Since:
- 2.1
- See Also:
-
refcount
Get 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
- ifkey
is null.- Since:
- 2.1
- See Also:
-