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 Type
    Method
    Description
    reactor.core.publisher.Mono<Boolean>
    delete(H key)
    Removes the given key.
    reactor.core.publisher.Flux<Map.Entry<HK,HV>>
    entries(H key)
    Get entire hash stored at key.
    reactor.core.publisher.Mono<HV>
    get(H key, Object hashKey)
    Get value for given hashKey from hash at key.
    reactor.core.publisher.Mono<Boolean>
    hasKey(H key, Object hashKey)
    Determine if given hash hashKey exists.
    reactor.core.publisher.Mono<Double>
    increment(H key, HK hashKey, double delta)
    Increment value of a hash hashKey by the given delta.
    reactor.core.publisher.Mono<Long>
    increment(H key, HK hashKey, long delta)
    Increment value of a hash hashKey by the given delta.
    reactor.core.publisher.Flux<HK>
    keys(H key)
    Get key set (fields) of hash at key.
    reactor.core.publisher.Mono<List<HV>>
    multiGet(H key, Collection<HK> hashKeys)
    Get values for given hashKeys from hash at key.
    reactor.core.publisher.Mono<Boolean>
    put(H key, HK hashKey, HV value)
    Set the value of a hash hashKey.
    reactor.core.publisher.Mono<Boolean>
    putAll(H key, Map<? extends HK,? extends HV> map)
    Set multiple hash fields to multiple values using data provided in m.
    reactor.core.publisher.Mono<Boolean>
    putIfAbsent(H key, HK hashKey, HV value)
    Set the value of a hash hashKey only if hashKey does not exist.
    reactor.core.publisher.Flux<Map.Entry<HK,HV>>
    randomEntries(H key, long count)
    Return random entries from the hash stored at key.
    reactor.core.publisher.Mono<Map.Entry<HK,HV>>
    Return a random entry from the hash stored at key.
    reactor.core.publisher.Mono<HK>
    randomKey(H key)
    Return a random hash key (aka field) from the hash stored at key.
    reactor.core.publisher.Flux<HK>
    randomKeys(H key, long count)
    Return random hash keys (aka fields) from the hash stored at key.
    reactor.core.publisher.Mono<Long>
    remove(H key, Object... hashKeys)
    Delete given hash hashKeys from the hash at key.
    default reactor.core.publisher.Flux<Map.Entry<HK,HV>>
    scan(H key)
    Use a Flux to iterate over entries in the hash at key.
    reactor.core.publisher.Flux<Map.Entry<HK,HV>>
    scan(H key, ScanOptions options)
    Use a Flux to iterate over entries in the hash at key given ScanOptions.
    reactor.core.publisher.Mono<Long>
    size(H key)
    Get size of hash at key.
    reactor.core.publisher.Flux<HV>
    values(H key)
    Get entry set (values) of hash at key.
  • Method Details

    • remove

      reactor.core.publisher.Mono<Long> remove(H key, Object... hashKeys)
      Delete given hash hashKeys from the hash at key.
      Parameters:
      key - must not be null.
      hashKeys - must not be null.
      Returns:
    • hasKey

      reactor.core.publisher.Mono<Boolean> hasKey(H key, Object hashKey)
      Determine if given hash hashKey exists.
      Parameters:
      key - must not be null.
      hashKey - must not be null.
      Returns:
    • get

      reactor.core.publisher.Mono<HV> get(H key, Object hashKey)
      Get value for given hashKey from hash at key.
      Parameters:
      key - must not be null.
      hashKey - must not be null.
      Returns:
    • multiGet

      reactor.core.publisher.Mono<List<HV>> multiGet(H key, Collection<HK> hashKeys)
      Get values for given hashKeys from hash at key. Values are in the order of the requested keys. Absent field values are represented using null in the resulting List.
      Parameters:
      key - must not be null.
      hashKeys - must not be null.
      Returns:
    • increment

      reactor.core.publisher.Mono<Long> increment(H key, HK hashKey, long delta)
      Increment value of a hash hashKey by the given delta.
      Parameters:
      key - must not be null.
      hashKey - must not be null.
      delta -
      Returns:
    • increment

      reactor.core.publisher.Mono<Double> increment(H key, HK hashKey, double delta)
      Increment value of a hash hashKey by the given delta.
      Parameters:
      key - must not be null.
      hashKey - must not be null.
      delta -
      Returns:
    • randomKey

      reactor.core.publisher.Mono<HK> randomKey(H key)
      Return a random hash key (aka field) from the hash stored at key.
      Parameters:
      key - must not be null.
      Returns:
      Since:
      2.6
      See Also:
    • randomEntry

      reactor.core.publisher.Mono<Map.Entry<HK,HV>> randomEntry(H key)
      Return a random entry from the hash stored at key.
      Parameters:
      key - must not be null.
      Returns:
      Since:
      2.6
      See Also:
    • randomKeys

      reactor.core.publisher.Flux<HK> randomKeys(H key, long count)
      Return random hash keys (aka fields) from the hash stored at key. If the provided count argument is positive, return a list of distinct hash keys, capped either at count or the hash size. If count 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

      reactor.core.publisher.Flux<Map.Entry<HK,HV>> randomEntries(H key, long count)
      Return random entries from the hash stored at key. If the provided count argument is positive, return a list of distinct entries, capped either at count or the hash size. If count 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

      reactor.core.publisher.Flux<HK> keys(H key)
      Get key set (fields) of hash at key.
      Parameters:
      key - must not be null.
      Returns:
    • size

      reactor.core.publisher.Mono<Long> size(H key)
      Get size of hash at key.
      Parameters:
      key - must not be null.
      Returns:
    • putAll

      reactor.core.publisher.Mono<Boolean> putAll(H key, Map<? extends HK,? extends HV> map)
      Set multiple hash fields to multiple values using data provided in m.
      Parameters:
      key - must not be null.
      map - must not be null.
    • put

      reactor.core.publisher.Mono<Boolean> put(H key, HK hashKey, HV value)
      Set the value of a hash hashKey.
      Parameters:
      key - must not be null.
      hashKey - must not be null.
      value -
    • putIfAbsent

      reactor.core.publisher.Mono<Boolean> putIfAbsent(H key, HK hashKey, HV value)
      Set the value of a hash hashKey only if hashKey does not exist.
      Parameters:
      key - must not be null.
      hashKey - must not be null.
      value -
      Returns:
    • values

      reactor.core.publisher.Flux<HV> values(H key)
      Get entry set (values) of hash at key.
      Parameters:
      key - must not be null.
      Returns:
    • entries

      reactor.core.publisher.Flux<Map.Entry<HK,HV>> entries(H key)
      Get entire hash stored at key.
      Parameters:
      key - must not be null.
      Returns:
    • scan

      default reactor.core.publisher.Flux<Map.Entry<HK,HV>> scan(H key)
      Use a Flux to iterate over entries in the hash at key. The resulting Flux acts as a cursor and issues HSCAN commands itself as long as the subscriber signals demand.
      Parameters:
      key - must not be null.
      Returns:
      the Flux emitting the entries on by one or an empty flux if the key does not exist.
      Throws:
      IllegalArgumentException - when the given key is null.
      Since:
      2.1
      See Also:
    • scan

      reactor.core.publisher.Flux<Map.Entry<HK,HV>> scan(H key, ScanOptions options)
      Use a Flux to iterate over entries in the hash at key given ScanOptions. The resulting Flux acts as a cursor and issues HSCAN commands itself as long as the subscriber signals demand.
      Parameters:
      key - must not be null.
      options - must not be null. Use ScanOptions.NONE instead.
      Returns:
      the Flux emitting the entries on by one or an empty flux if the key does not exist.
      Throws:
      IllegalArgumentException - when one of the required arguments is null.
      Since:
      2.1
      See Also:
    • delete

      reactor.core.publisher.Mono<Boolean> delete(H key)
      Removes the given key.
      Parameters:
      key - must not be null.