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 givenhashKeyfrom hash atkey.reactor.core.publisher.Mono<Boolean>Determine if given hashhashKeyexists.reactor.core.publisher.Mono<Double>Incrementvalueof a hashhashKeyby the givendelta.reactor.core.publisher.Mono<Long>Incrementvalueof a hashhashKeyby the givendelta.reactor.core.publisher.Flux<HK>Get key set (fields) of hash atkey.multiGet(H key, Collection<HK> hashKeys) Get values for givenhashKeysfrom hash atkey.reactor.core.publisher.Mono<Boolean>Set thevalueof 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 thevalueof a hashhashKeyonly ifhashKeydoes 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 hashhashKeysfrom the hash at key.Use aFluxto 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 hashhashKeysfrom the hash at key.- Parameters:
key- must not be null.hashKeys- must not be null.- Returns:
-
hasKey
Determine if given hashhashKeyexists.- Parameters:
key- must not be null.hashKey- must not be null.- Returns:
-
get
Get value for givenhashKeyfrom hash atkey.- Parameters:
key- must not be null.hashKey- must not be null.- Returns:
-
multiGet
Get values for givenhashKeysfrom hash atkey. 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.hashKeys- must not be null.- Returns:
-
increment
Incrementvalueof a hashhashKeyby the givendelta.- Parameters:
key- must not be null.hashKey- must not be null.delta-- Returns:
-
increment
Incrementvalueof a hashhashKeyby 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 providedcountargument is positive, return a list of distinct hash keys, capped either atcountor the hash size. Ifcountis 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 providedcountargument is positive, return a list of distinct entries, capped either atcountor the hash size. Ifcountis 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 thevalueof a hashhashKey.- Parameters:
key- must not be null.hashKey- must not be null.value-
-
putIfAbsent
Set thevalueof a hashhashKeyonly ifhashKeydoes 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 aFluxto iterate over entries in the hash atkey. The resultingFluxacts as a cursor and issuesHSCANcommands itself as long as the subscriber signals demand.- Parameters:
key- must not be null.- Returns:
- the
Fluxemitting theentrieson by one or anempty fluxif the key does not exist. - Throws:
IllegalArgumentException- when the givenkeyis null.- Since:
- 2.1
- See Also:
-
scan
Use aFluxto iterate over entries in the hash atkeygivenScanOptions. The resultingFluxacts as a cursor and issuesHSCANcommands itself as long as the subscriber signals demand.- Parameters:
key- must not be null.options- must not be null. UseScanOptions.NONEinstead.- Returns:
- the
Fluxemitting theentrieson by one or anempty fluxif 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.
-