Interface ReactiveHashOperations<H,HK,HV>
public interface ReactiveHashOperations<H,HK,HV>
Reactive Redis operations for Hash Commands.
Streams of methods returning Mono<K>
or Flux<M>
are terminated with
InvalidDataAccessApiUsageException
when
RedisElementReader.read(ByteBuffer)
returns null
for a
particular element as Reactive Streams prohibit the usage of null
values.
- Since:
- 2.0
- Author:
- Mark Paluch, Christoph Strobl
-
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<Boolean>
Removes the given key.Get entire hash stored atkey
.reactor.core.publisher.Mono<HV>
Get value for givenhashKey
from hash atkey
.reactor.core.publisher.Mono<Boolean>
Determine if given hashhashKey
exists.reactor.core.publisher.Mono<Double>
Incrementvalue
of a hashhashKey
by the givendelta
.reactor.core.publisher.Mono<Long>
Incrementvalue
of a hashhashKey
by the givendelta
.reactor.core.publisher.Flux<HK>
Get key set (fields) of hash atkey
.multiGet
(H key, Collection<HK> hashKeys) Get values for givenhashKeys
from hash atkey
.reactor.core.publisher.Mono<Boolean>
Set thevalue
of a hashhashKey
.reactor.core.publisher.Mono<Boolean>
Set multiple hash fields to multiple values using data provided inm
.reactor.core.publisher.Mono<Boolean>
putIfAbsent
(H key, HK hashKey, HV value) Set thevalue
of a hashhashKey
only ifhashKey
does not exist.randomEntries
(H key, long count) Return random entries from the hash stored atkey
.randomEntry
(H key) Return a random entry from the hash stored atkey
.reactor.core.publisher.Mono<HK>
Return a random hash key (aka field) from the hash stored atkey
.reactor.core.publisher.Flux<HK>
randomKeys
(H key, long count) Return random hash keys (aka fields) from the hash stored atkey
.reactor.core.publisher.Mono<Long>
Delete given hashhashKeys
from the hash at key.Use aFlux
to iterate over entries in the hash atkey
.scan
(H key, ScanOptions options) reactor.core.publisher.Mono<Long>
Get size of hash atkey
.reactor.core.publisher.Flux<HV>
Get entry set (values) of hash atkey
.
-
Method Details
-
remove
Delete given hashhashKeys
from the hash at key.- Parameters:
key
- must not be null.hashKeys
- must not be null.- Returns:
-
hasKey
Determine if given hashhashKey
exists.- Parameters:
key
- must not be null.hashKey
- must not be null.- Returns:
-
get
Get value for givenhashKey
from hash atkey
.- Parameters:
key
- must not be null.hashKey
- must not be null.- Returns:
-
multiGet
Get values for givenhashKeys
from hash atkey
. Values are in the order of the requested keys. Absent field values are represented usingnull
in the resultingList
.- Parameters:
key
- must not be null.hashKeys
- must not be null.- Returns:
-
increment
Incrementvalue
of a hashhashKey
by the givendelta
.- Parameters:
key
- must not be null.hashKey
- must not be null.delta
-- Returns:
-
increment
Incrementvalue
of a hashhashKey
by the givendelta
.- Parameters:
key
- must not be null.hashKey
- must not be null.delta
-- Returns:
-
randomKey
Return a random hash key (aka field) from the hash stored atkey
.- Parameters:
key
- must not be null.- Returns:
- Since:
- 2.6
- See Also:
-
randomEntry
Return a random entry from the hash stored atkey
.- Parameters:
key
- must not be null.- Returns:
- Since:
- 2.6
- See Also:
-
randomKeys
Return random hash keys (aka fields) from the hash stored atkey
. If the providedcount
argument is positive, return a list of distinct hash keys, capped either atcount
or the hash size. Ifcount
is negative, the behavior changes and the command is allowed to return the same hash key 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:
-
randomEntries
Return random entries from the hash stored atkey
. If the providedcount
argument is positive, return a list of distinct entries, capped either atcount
or the hash size. Ifcount
is negative, the behavior changes and the command is allowed to return the same entry 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:
-
keys
Get key set (fields) of hash atkey
.- Parameters:
key
- must not be null.- Returns:
-
size
Get size of hash atkey
.- Parameters:
key
- must not be null.- Returns:
-
putAll
Set multiple hash fields to multiple values using data provided inm
.- Parameters:
key
- must not be null.map
- must not be null.
-
put
Set thevalue
of a hashhashKey
.- Parameters:
key
- must not be null.hashKey
- must not be null.value
-
-
putIfAbsent
Set thevalue
of a hashhashKey
only ifhashKey
does not exist.- Parameters:
key
- must not be null.hashKey
- must not be null.value
-- Returns:
-
values
Get entry set (values) of hash atkey
.- Parameters:
key
- must not be null.- Returns:
-
entries
Get entire hash stored atkey
.- Parameters:
key
- must not be null.- Returns:
-
scan
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
emitting theentries
on by one or anempty flux
if the key does not exist. - Throws:
IllegalArgumentException
- when the givenkey
is null.- Since:
- 2.1
- See Also:
-
scan
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 theentries
on by one or anempty flux
if the key does not exist. - Throws:
IllegalArgumentException
- when one of the required arguments is null.- Since:
- 2.1
- See Also:
-
delete
Removes the given key.- Parameters:
key
- must not be null.
-