Interface ReactiveHashCommands
- All Known Subinterfaces:
ReactiveClusterHashCommands
public interface ReactiveHashCommands
Redis Hash commands executed using reactive infrastructure.
- Since:
- 2.0
- Author:
- Christoph Strobl, Mark Paluch, Tihomir Mateev
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
static class
ReactiveRedisConnection.Command
for hash-bound operations.static class
static class
HEXISTSReactiveRedisConnection.Command
.static class
static class
HRANDFIELDReactiveRedisConnection.Command
.static class
static class
-
Method Summary
Modifier and TypeMethodDescriptionhDel
(ByteBuffer key, ByteBuffer field) Delete given hash field.hDel
(ByteBuffer key, Collection<ByteBuffer> fields) Delete given hash fields.hDel
(Publisher<ReactiveHashCommands.HDelCommand> commands) Delete given hash fields.hExists
(ByteBuffer key, ByteBuffer field) Determine if given hash field exists.hExists
(Publisher<ReactiveHashCommands.HExistsCommand> commands) Determine if given hash field exists.hExpire
(ByteBuffer key, Duration duration, ByteBuffer field) Expire a given field after a givenDuration
of time, measured in milliseconds, has passed.hExpire
(ByteBuffer key, Duration duration, List<ByteBuffer> fields) hExpireAt
(ByteBuffer key, Instant expireAt, ByteBuffer field) Expire a given field in a givenInstant
of time, indicated as an absolute Unix timestamp in seconds since Unix epochhExpireAt
(ByteBuffer key, Instant expireAt, List<ByteBuffer> fields) Expire aList
of field in a givenInstant
of time, indicated as an absolute Unix timestamp in seconds since Unix epochdefault Mono<ByteBuffer>
hGet
(ByteBuffer key, ByteBuffer field) Get value for given field from hash at key.default Flux<Map.Entry<ByteBuffer,
ByteBuffer>> hGetAll
(ByteBuffer key) Get entire hash stored at key.Flux<ReactiveRedisConnection.CommandResponse<ReactiveRedisConnection.KeyCommand,
Flux<Map.Entry<ByteBuffer, ByteBuffer>>>> hGetAll
(Publisher<ReactiveRedisConnection.KeyCommand> commands) Get entire hash stored at key.default Flux<ByteBuffer>
hKeys
(ByteBuffer key) Get key set (fields) of hash at key.hKeys
(Publisher<ReactiveRedisConnection.KeyCommand> commands) Get key set (fields) of hash at key.hLen
(ByteBuffer key) Get size of hash at key.hLen
(Publisher<ReactiveRedisConnection.KeyCommand> commands) Get size of hash at key.default Mono<List<ByteBuffer>>
hMGet
(ByteBuffer key, Collection<ByteBuffer> fields) Get values for given fields from hash at key.hMGet
(Publisher<ReactiveHashCommands.HGetCommand> commands) Get values for given fields from hash at key.hMSet
(ByteBuffer key, Map<ByteBuffer, ByteBuffer> fieldValueMap) Set multiple hash fields to multiple values using data provided in fieldValueMap.hPersist
(ByteBuffer key, ByteBuffer field) Persist a given field removing any associated expiration, measured as absolute Unix timestamp in seconds since Unix epochhPersist
(ByteBuffer key, List<ByteBuffer> fields) Persist a givenList
of field removing any associated expiration.Persist a givenList
of field removing any associated expiration.hpExpire
(ByteBuffer key, Duration duration, ByteBuffer field) Expire a given field after a givenDuration
of time, measured in milliseconds, has passed.hpExpire
(ByteBuffer key, Duration duration, List<ByteBuffer> fields) hpExpireAt
(ByteBuffer key, Instant expireAt, ByteBuffer field) Expire a given field in a givenInstant
of time, indicated as an absolute Unix timestamp in milliseconds since Unix epochhpExpireAt
(ByteBuffer key, Instant expireAt, List<ByteBuffer> fields) Expire aList
of field in a givenInstant
of time, indicated as an absolute Unix timestamp in milliseconds since Unix epochhpTtl
(ByteBuffer key, ByteBuffer field) Returns the time-to-live of a given field in milliseconds.hpTtl
(ByteBuffer key, List<ByteBuffer> fields) Returns the time-to-live of all the given field in theList
in milliseconds.hpTtl
(Publisher<ReactiveHashCommands.HashFieldsCommand> commands) Returns the time-to-live of all the given field in theList
in milliseconds.default Mono<ByteBuffer>
hRandField
(ByteBuffer key) Return a random field from the hash stored atkey
.default Flux<ByteBuffer>
hRandField
(ByteBuffer key, long count) Return a random field from the hash stored atkey
.Flux<ReactiveRedisConnection.CommandResponse<ReactiveHashCommands.HRandFieldCommand,
Flux<ByteBuffer>>> Get random fields of hash at key.default Mono<Map.Entry<ByteBuffer,
ByteBuffer>> Return a random field from the hash along with its value stored atkey
.default Flux<Map.Entry<ByteBuffer,
ByteBuffer>> hRandFieldWithValues
(ByteBuffer key, long count) Return a random field from the hash along with its value stored atkey
.Flux<ReactiveRedisConnection.CommandResponse<ReactiveHashCommands.HRandFieldCommand,
Flux<Map.Entry<ByteBuffer, ByteBuffer>>>> Get random fields along their values of hash at key.default Flux<Map.Entry<ByteBuffer,
ByteBuffer>> hScan
(ByteBuffer key) Use aFlux
to iterate over entries in the hash atkey
.default Flux<Map.Entry<ByteBuffer,
ByteBuffer>> hScan
(ByteBuffer key, ScanOptions options) Flux<ReactiveRedisConnection.CommandResponse<ReactiveRedisConnection.KeyCommand,
Flux<Map.Entry<ByteBuffer, ByteBuffer>>>> hScan
(Publisher<ReactiveRedisConnection.KeyScanCommand> commands) Use aFlux
to iterate over entries in the hash atkey
.hSet
(ByteBuffer key, ByteBuffer field, ByteBuffer value) Set the value of a hash field.hSet
(Publisher<ReactiveHashCommands.HSetCommand> commands) Set the value of a hash field.hSetNX
(ByteBuffer key, ByteBuffer field, ByteBuffer value) Set the value of a hash field.hStrLen
(ByteBuffer key, ByteBuffer field) Get the length of the value associated withfield
.hStrLen
(Publisher<ReactiveHashCommands.HStrLenCommand> commands) Get the length of the value associated withfield
.hTtl
(ByteBuffer key, ByteBuffer field) Returns the time-to-live of a given field in seconds.hTtl
(ByteBuffer key, List<ByteBuffer> fields) Returns the time-to-live of all the given field in theList
in seconds.hTtl
(Publisher<ReactiveHashCommands.HashFieldsCommand> commands) Returns the time-to-live of all the given field in theList
in seconds.default Flux<ByteBuffer>
hVals
(ByteBuffer key) Get entry set (values) of hash at key.hVals
(Publisher<ReactiveRedisConnection.KeyCommand> commands) Get entry set (values) of hash at key.
-
Method Details
-
hSet
Set the value of a hash field.- Parameters:
key
- must not be null.field
- must not be null.value
- must not be null.- Returns:
- See Also:
-
hSetNX
Set the value of a hash field.- Parameters:
key
- must not be null.field
- must not be null.value
- must not be null.- Returns:
- See Also:
-
hMSet
Set multiple hash fields to multiple values using data provided in fieldValueMap.- Parameters:
key
- must not be null.fieldValueMap
- must not be null.- Returns:
- See Also:
-
hSet
Flux<ReactiveRedisConnection.BooleanResponse<ReactiveHashCommands.HSetCommand>> hSet(Publisher<ReactiveHashCommands.HSetCommand> commands) Set the value of a hash field.- Parameters:
commands
- must not be null.- Returns:
- See Also:
-
hGet
Get value for given field from hash at key.- Parameters:
key
- must not be null.field
- must not be null.- Returns:
- See Also:
-
hMGet
Get values for given fields from hash at key. Values are in the order of the requested keys. Absent field values are represented using null in the resultingList
.- Parameters:
key
- must not be null.fields
- must not be null.- Returns:
- See Also:
-
hMGet
Flux<ReactiveRedisConnection.MultiValueResponse<ReactiveHashCommands.HGetCommand,ByteBuffer>> hMGet(Publisher<ReactiveHashCommands.HGetCommand> commands) Get values for given fields from hash at key. Values are in the order of the requested keys. Absent field values are represented using null in the resultingList
.- Parameters:
commands
- must not be null.- Returns:
- See Also:
-
hExists
Determine if given hash field exists.- Parameters:
key
- must not be null.field
- must not be null.- Returns:
- See Also:
-
hExists
Flux<ReactiveRedisConnection.BooleanResponse<ReactiveHashCommands.HExistsCommand>> hExists(Publisher<ReactiveHashCommands.HExistsCommand> commands) Determine if given hash field exists.- Parameters:
commands
-- Returns:
- See Also:
-
hDel
Delete given hash field.- Parameters:
key
- must not be null.field
- must not be null.- Returns:
- See Also:
-
hDel
Delete given hash fields.- Parameters:
key
- must not be null.fields
- must not be null.- Returns:
- See Also:
-
hDel
Flux<ReactiveRedisConnection.NumericResponse<ReactiveHashCommands.HDelCommand,Long>> hDel(Publisher<ReactiveHashCommands.HDelCommand> commands) Delete given hash fields.- Parameters:
commands
- must not be null.- Returns:
- See Also:
-
hLen
Get size of hash at key.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
hLen
Flux<ReactiveRedisConnection.NumericResponse<ReactiveRedisConnection.KeyCommand,Long>> hLen(Publisher<ReactiveRedisConnection.KeyCommand> commands) Get size of hash at key.- Parameters:
commands
- must not be null.- Returns:
- See Also:
-
hRandField
Return a random field from the hash stored atkey
.- Parameters:
key
- must not be null.- Returns:
- Since:
- 2.6
- See Also:
-
hRandFieldWithValues
Return a random field from the hash along with its value stored atkey
.- Parameters:
key
- must not be null.- Returns:
- Since:
- 2.6
- See Also:
-
hRandField
Return a random field from the hash stored atkey
. If the providedcount
argument is positive, return a list of distinct fields, capped either atcount
or the hash size. Ifcount
is negative, the behavior changes and the command is allowed to return the same field multiple times. In this case, the number of returned fields is the absolute value of the specified count.- Parameters:
key
- must not be null.count
- number of fields to return.- Returns:
- Since:
- 2.6
- See Also:
-
hRandFieldWithValues
Return a random field from the hash along with its value stored atkey
. If the providedcount
argument is positive, return a list of distinct fields, capped either atcount
or the hash size. Ifcount
is negative, the behavior changes and the command is allowed to return the same field multiple times. In this case, the number of returned fields is the absolute value of the specified count.- Parameters:
key
- must not be null.count
- number of fields to return.- Returns:
- null if key does not exist or when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
hRandField
Flux<ReactiveRedisConnection.CommandResponse<ReactiveHashCommands.HRandFieldCommand,Flux<ByteBuffer>>> hRandField(Publisher<ReactiveHashCommands.HRandFieldCommand> commands) Get random fields of hash at key.- Parameters:
commands
- must not be null.- Returns:
- Since:
- 2.6
- See Also:
-
hRandFieldWithValues
Flux<ReactiveRedisConnection.CommandResponse<ReactiveHashCommands.HRandFieldCommand,Flux<Map.Entry<ByteBuffer, hRandFieldWithValuesByteBuffer>>>> (Publisher<ReactiveHashCommands.HRandFieldCommand> commands) Get random fields along their values of hash at key.- Parameters:
commands
- must not be null.- Returns:
- Since:
- 2.6
- See Also:
-
hKeys
Get key set (fields) of hash at key.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
hKeys
Flux<ReactiveRedisConnection.CommandResponse<ReactiveRedisConnection.KeyCommand,Flux<ByteBuffer>>> hKeys(Publisher<ReactiveRedisConnection.KeyCommand> commands) Get key set (fields) of hash at key.- Parameters:
commands
- must not be null.- Returns:
- See Also:
-
hVals
Get entry set (values) of hash at key.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
hVals
Flux<ReactiveRedisConnection.CommandResponse<ReactiveRedisConnection.KeyCommand,Flux<ByteBuffer>>> hVals(Publisher<ReactiveRedisConnection.KeyCommand> commands) Get entry set (values) of hash at key.- Parameters:
commands
- must not be null.- Returns:
- See Also:
-
hGetAll
Get entire hash stored at key.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
hGetAll
Flux<ReactiveRedisConnection.CommandResponse<ReactiveRedisConnection.KeyCommand,Flux<Map.Entry<ByteBuffer, hGetAllByteBuffer>>>> (Publisher<ReactiveRedisConnection.KeyCommand> commands) Get entire hash stored at key.- Parameters:
commands
- must not be null.- Returns:
- See Also:
-
hScan
Use aFlux
to iterate over entries in the hash atkey
. The resultingFlux
acts as a cursor and issuesHSCAN
commands itself as long as the subscriber signals demand.- Parameters:
key
- must not be null.- Returns:
- the
Flux
emittingentries
one by one. - Throws:
IllegalArgumentException
- in case the given key is null.- Since:
- 2.1
- See Also:
-
hScan
Use aFlux
to iterate over entries in the hash atkey
givenScanOptions
. The resultingFlux
acts as a cursor and issuesHSCAN
commands itself as long as the subscriber signals demand.- Parameters:
key
- must not be null.options
- must not be null. UseScanOptions.NONE
instead.- Returns:
- the
Flux
emitting the rawentries
one by one. - Throws:
IllegalArgumentException
- in case one of the required arguments is null.- Since:
- 2.1
- See Also:
-
hScan
Flux<ReactiveRedisConnection.CommandResponse<ReactiveRedisConnection.KeyCommand,Flux<Map.Entry<ByteBuffer, hScanByteBuffer>>>> (Publisher<ReactiveRedisConnection.KeyScanCommand> commands) Use aFlux
to iterate over entries in the hash atkey
. The resultingFlux
acts as a cursor and issuesHSCAN
commands itself as long as the subscriber signals demand.- Parameters:
commands
- must not be null.- Returns:
- the
Flux
emittingReactiveRedisConnection.CommandResponse
one by one. - Since:
- 2.1
- See Also:
-
hStrLen
Get the length of the value associated withfield
. If either thekey
or thefield
do not exist,0
is emitted.- Parameters:
key
- must not be null.field
- must not be null.- Returns:
- never null.
- Since:
- 2.1
-
hStrLen
Flux<ReactiveRedisConnection.NumericResponse<ReactiveHashCommands.HStrLenCommand,Long>> hStrLen(Publisher<ReactiveHashCommands.HStrLenCommand> commands) Get the length of the value associated withfield
. If either thekey
or thefield
do not exist,0
is emitted.- Parameters:
commands
- must not be null.- Returns:
- never null.
- Since:
- 2.1
-
hExpire
Expire a given field after a givenDuration
of time, measured in milliseconds, has passed.- Parameters:
key
- must not be null.field
- must not be null.duration
- must not be null.- Returns:
- a
Mono
emitting the expiration result -2
indicating the specific field is deleted already due to expiration, or provided expiry interval is 0;1
indicating expiration time is set/updated;0
indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met);-2
indicating there is no such field; - Since:
- 3.5
- See Also:
-
hExpire
- Parameters:
key
- must not be null.fields
- must not be null.duration
- must not be null.- Returns:
- a
Flux
emitting the expiration results one by one,2
indicating the specific field is deleted already due to expiration, or provided expiry interval is 0;1
indicating expiration time is set/updated;0
indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met);-2
indicating there is no such field; - Since:
- 3.5
- See Also:
-
applyHashFieldExpiration
Flux<ReactiveRedisConnection.NumericResponse<ReactiveHashCommands.HashExpireCommand,Long>> applyHashFieldExpiration(Publisher<ReactiveHashCommands.HashExpireCommand> commands) - Parameters:
commands
- must not be null.- Returns:
- a
Flux
emitting the expiration results one by one,2
indicating the specific field is deleted already due to expiration, or provided expiry interval is 0;1
indicating expiration time is set/updated;0
indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met);-2
indicating there is no such field; - Since:
- 3.5
- See Also:
-
hpExpire
Expire a given field after a givenDuration
of time, measured in milliseconds, has passed.- Parameters:
key
- must not be null.field
- must not be null.duration
- must not be null.- Returns:
- a
Mono
emitting the expiration result -2
indicating the specific field is deleted already due to expiration, or provided expiry interval is 0;1
indicating expiration time is set/updated;0
indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met);-2
indicating there is no such field; - Since:
- 3.5
- See Also:
-
hpExpire
- Parameters:
key
- must not be null.fields
- must not be null.duration
- must not be null.- Returns:
- a
Flux
emitting the expiration results one by one,2
indicating the specific field is deleted already due to expiration, or provided expiry interval is 0;1
indicating expiration time is set/updated;0
indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met);-2
indicating there is no such field; - Since:
- 3.5
- See Also:
-
hExpireAt
Expire a given field in a givenInstant
of time, indicated as an absolute Unix timestamp in seconds since Unix epoch- Parameters:
key
- must not be null.field
- must not be null.expireAt
- must not be null.- Returns:
- a
Mono
emitting the expiration result -2
indicating the specific field is deleted already due to expiration, or provided expiry interval is in the past;1
indicating expiration time is set/updated;0
indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met);-2
indicating there is no such field; - Since:
- 3.5
- See Also:
-
hExpireAt
Expire aList
of field in a givenInstant
of time, indicated as an absolute Unix timestamp in seconds since Unix epoch- Parameters:
key
- must not be null.fields
- must not be null.expireAt
- must not be null.- Returns:
- a
Flux
emitting the expiration results one by one,2
indicating the specific field is deleted already due to expiration, or provided expiry interval is in the past;1
indicating expiration time is set/updated;0
indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met);-2
indicating there is no such field; - Since:
- 3.5
- See Also:
-
hpExpireAt
Expire a given field in a givenInstant
of time, indicated as an absolute Unix timestamp in milliseconds since Unix epoch- Parameters:
key
- must not be null.field
- must not be null.expireAt
- must not be null.- Returns:
- a
Mono
emitting the expiration result -2
indicating the specific field is deleted already due to expiration, or provided expiry interval is in the past;1
indicating expiration time is set/updated;0
indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met);-2
indicating there is no such field; - Since:
- 3.5
- See Also:
-
hpExpireAt
Expire aList
of field in a givenInstant
of time, indicated as an absolute Unix timestamp in milliseconds since Unix epoch- Parameters:
key
- must not be null.fields
- must not be null.expireAt
- must not be null.- Returns:
- a
Flux
emitting the expiration results one by one,2
indicating the specific field is deleted already due to expiration, or provided expiry interval is in the past;1
indicating expiration time is set/updated;0
indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met);-2
indicating there is no such field; - Since:
- 3.5
- See Also:
-
hPersist
Persist a given field removing any associated expiration, measured as absolute Unix timestamp in seconds since Unix epoch- Parameters:
key
- must not be null.field
- must not be null.- Returns:
- a
Mono
emitting the persist result -1
indicating expiration time is removed;-1
field has no expiration time to be removed;-2
indicating there is no such field; - Since:
- 3.5
- See Also:
-
hPersist
Persist a givenList
of field removing any associated expiration.- Parameters:
key
- must not be null.fields
- must not be null.- Returns:
- a
Flux
emitting the persisting results one by one -1
indicating expiration time is removed;-1
field has no expiration time to be removed;-2
indicating there is no such field; - Since:
- 3.5
- See Also:
-
hPersist
Flux<ReactiveRedisConnection.NumericResponse<ReactiveHashCommands.HashFieldsCommand,Long>> hPersist(Publisher<ReactiveHashCommands.HashFieldsCommand> commands) Persist a givenList
of field removing any associated expiration.- Parameters:
commands
- must not be null.- Returns:
- a
Flux
emitting the persisting results one by one -1
indicating expiration time is removed;-1
field has no expiration time to be removed;-2
indicating there is no such field; * @since 3.5 - See Also:
-
hTtl
Returns the time-to-live of a given field in seconds.- Parameters:
key
- must not be null.field
- must not be null.- Returns:
- a
Mono
emitting the TTL result - the time to live in seconds; or a negative value to signal an error. The command returns-1
if the key exists but has no associated expiration time. The command returns-2
if the key does not exist; - Since:
- 3.5
- See Also:
-
hTtl
Returns the time-to-live of all the given field in theList
in seconds.- Parameters:
key
- must not be null.fields
- must not be null.- Returns:
- a
Flux
emitting the TTL results one by one - the time to live in seconds; or a negative value to signal an error. The command returns-1
if the key exists but has no associated expiration time. The command returns-2
if the key does not exist; - Since:
- 3.5
- See Also:
-
hTtl
Flux<ReactiveRedisConnection.NumericResponse<ReactiveHashCommands.HashFieldsCommand,Long>> hTtl(Publisher<ReactiveHashCommands.HashFieldsCommand> commands) Returns the time-to-live of all the given field in theList
in seconds.- Parameters:
commands
- must not be null.- Returns:
- a
Flux
emitting the persisting results one by one - the time to live in seconds; or a negative value to signal an error. The command returns-1
if the key exists but has no associated expiration time. The command returns-2
if the key does not exist; - Since:
- 3.5
- See Also:
-
hpTtl
Returns the time-to-live of a given field in milliseconds.- Parameters:
key
- must not be null.field
- must not be null.- Returns:
- a
Mono
emitting the TTL result - the time to live in milliseconds; or a negative value to signal an error. The command returns-1
if the key exists but has no associated expiration time. The command returns-2
if the key does not exist; - Since:
- 3.5
- See Also:
-
hpTtl
Returns the time-to-live of all the given field in theList
in milliseconds.- Parameters:
key
- must not be null.fields
- must not be null.- Returns:
- a
Flux
emitting the TTL results one by one - the time to live in milliseconds; or a negative value to signal an error. The command returns-1
if the key exists but has no associated expiration time. The command returns-2
if the key does not exist; - Since:
- 3.5
- See Also:
-
hpTtl
Flux<ReactiveRedisConnection.NumericResponse<ReactiveHashCommands.HashFieldsCommand,Long>> hpTtl(Publisher<ReactiveHashCommands.HashFieldsCommand> commands) Returns the time-to-live of all the given field in theList
in milliseconds.- Parameters:
commands
- must not be null.- Returns:
- a
Flux
emitting the persisting results one by one - the time to live in milliseconds; or a negative value to signal an error. The command returns-1
if the key exists but has no associated expiration time. The command returns-2
if the key does not exist; - Since:
- 3.5
- See Also:
-