Interface BoundHashOperations<H,HK,HV>

All Superinterfaces:
BoundKeyOperations<H>

@NullUnmarked public interface BoundHashOperations<H,HK,HV> extends BoundKeyOperations<H>
Hash operations bound to a certain key.
Author:
Costin Leau, Christoph Strobl, Ninad Divadkar, Mark Paluch, Tihomir Mateev
  • Method Details

    • delete

      Long delete(@NonNull Object @NonNull ... keys)
      Delete given hash keys at the bound key.
      Parameters:
      keys - must not be null.
      Returns:
      null when used in pipeline / transaction.
    • hasKey

      Boolean hasKey(@NonNull Object key)
      Determine if given hash key exists at the bound key.
      Parameters:
      key - must not be null.
      Returns:
      null when used in pipeline / transaction.
    • get

      HV get(@NonNull Object member)
      Get value for given key from the hash at the bound key.
      Parameters:
      member - must not be null.
      Returns:
      null when member does not exist or when used in pipeline / transaction.
    • multiGet

      List<HV> multiGet(@NonNull Collection<@NonNull HK> keys)
      Get values for given keys from the hash at the bound key. Values are in the order of the requested keys Absent field values are represented using null in the resulting List.
      Parameters:
      keys - must not be null.
      Returns:
      null when used in pipeline / transaction.
    • increment

      Long increment(@NonNull HK key, long delta)
      Increment value of a hash key by the given delta at the bound key.
      Parameters:
      key - must not be null.
      delta -
      Returns:
      null when used in pipeline / transaction.
    • increment

      Double increment(@NonNull HK key, double delta)
      Increment value of a hash key by the given delta at the bound key.
      Parameters:
      key - must not be null.
      delta -
      Returns:
      null when used in pipeline / transaction.
    • randomKey

      HK randomKey()
      Return a random key from the hash stored at the bound key.
      Returns:
      null if the hash does not exist or when used in pipeline / transaction.
      Since:
      2.6
      See Also:
    • randomEntry

      Map.Entry<@NonNull HK, HV> randomEntry()
      Return a random entry from the hash stored at the bound key.
      Returns:
      null if key does not exist or when used in pipeline / transaction.
      Since:
      2.6
      See Also:
    • randomKeys

      List<@NonNull HK> randomKeys(long count)
      Return a random keys from the hash stored at the bound key. If the provided count argument is positive, return a list of distinct 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 key multiple times. In this case, the number of returned keys is the absolute value of the specified count.
      Parameters:
      count - number of keys to return.
      Returns:
      null if key does not exist or when used in pipeline / transaction.
      Since:
      2.6
      See Also:
    • randomEntries

      Map<@NonNull HK, HV> randomEntries(long count)
      Return a random entry from the hash stored at the bound key.
      Parameters:
      count - number of entries to return. Must be positive.
      Returns:
      null if the hash does not exist or when used in pipeline / transaction.
      Since:
      2.6
      See Also:
    • keys

      Set<@NonNull HK> keys()
      Get key set (fields) of hash at the bound key.
      Returns:
      null when used in pipeline / transaction.
    • lengthOfValue

      Long lengthOfValue(@NonNull HK hashKey)
      Returns the length of the value associated with hashKey. If the hashKey do not exist, 0 is returned.
      Parameters:
      hashKey - must not be null.
      Returns:
      null when used in pipeline / transaction.
      Since:
      2.1
    • size

      Long size()
      Get size of hash at the bound key.
      Returns:
      null when used in pipeline / transaction.
    • putAll

      void putAll(Map<? extends @NonNull HK, ? extends HV> m)
      Set multiple hash fields to multiple values using data provided in m at the bound key.
      Parameters:
      m - must not be null.
    • put

      void put(@NonNull HK key, HV value)
      Set the value of a hash key at the bound key.
      Parameters:
      key - must not be null.
      value -
    • putIfAbsent

      Boolean putIfAbsent(@NonNull HK key, HV value)
      Set the value of a hash key only if key does not exist.
      Parameters:
      key - must not be null.
      value -
      Returns:
      null when used in pipeline / transaction.
    • values

      List<HV> values()
      Get entry set (values) of hash at the bound key.
      Returns:
      null when used in pipeline / transaction.
    • entries

      Map<@NonNull HK, HV> entries()
      Get entire hash at the bound key.
      Returns:
      null when used in pipeline / transaction.
    • scan

      Cursor<Map.Entry<@NonNull HK, HV>> scan(@NonNull ScanOptions options)
      Use a Cursor to iterate over entries in hash at the bound key.
      Important: Call CloseableIterator.close() when done to avoid resource leaks.
      Parameters:
      options - must not be null.
      Returns:
      the result cursor providing access to the scan result. Must be closed once fully processed (e.g. through a try-with-resources clause).
      Since:
      1.4
    • hashExpiration

      default @NonNull BoundHashFieldExpirationOperations<HK> hashExpiration()
      Returns a bound operations object to perform operations on the hash field expiration for all hash fields at the bound key. Operations on the expiration object obtain keys at the time of invoking any expiration operation.
      Returns:
      the bound operations object to perform operations on the hash field expiration.
      Since:
      3.5
    • hashExpiration

      default @NonNull BoundHashFieldExpirationOperations<HK> hashExpiration(@NonNull HK @NonNull ... hashFields)
      Returns a bound operations object to perform operations on the hash field expiration for all hash fields at the bound key for the given hash fields.
      Parameters:
      hashFields - collection of hash fields to operate on.
      Returns:
      the bound operations object to perform operations on the hash field expiration.
      Since:
      3.5
    • hashExpiration

      default @NonNull BoundHashFieldExpirationOperations<HK> hashExpiration(@NonNull Collection<@NonNull HK> hashFields)
      Returns a bound operations object to perform operations on the hash field expiration for all hash fields at the bound key for the given hash fields.
      Parameters:
      hashFields - collection of hash fields to operate on.
      Returns:
      the bound operations object to perform operations on the hash field expiration.
      Since:
      3.5
    • getOperations

      @NonNull RedisOperations<H,?> getOperations()
      Specified by:
      getOperations in interface BoundKeyOperations<H>
      Returns:
      the underlying RedisOperations used to execute commands.
    • getAndDelete

      List<HV> getAndDelete(@NonNull Collection<@NonNull HK> hashFields)
      Get and remove the value for given hashFields from the hash at the bound key. Values are in the order of the requested hash fields. Absent field values are represented using null in the resulting List.
      Parameters:
      hashFields - must not be null.
      Returns:
      null when used in pipeline / transaction.
      Since:
      4.0
      See Also:
    • getAndExpire

      List<HV> getAndExpire(@Nullable Expiration expiration, @NonNull Collection<@NonNull HK> hashFields)
      Get and optionally expire the value for given hashFields from the hash at the bound key. Values are in the order of the requested hash fields. Absent field values are represented using null in the resulting List.
      Parameters:
      expiration - is optional.
      hashFields - must not be null.
      Returns:
      never null.
      Since:
      4.0
      See Also:
    • putAndExpire

      void putAndExpire(Map<? extends @NonNull HK, ? extends HV> m, @NonNull RedisHashCommands.HashFieldSetOption condition, @Nullable Expiration expiration)
      Set the value of one or more fields using data provided in m at the bound key, and optionally set their expiration time or time-to-live (TTL). The condition determines whether the fields are set.
      Parameters:
      m - must not be null.
      condition - must not be null. Use RedisHashCommands.HashFieldSetOption.IF_NONE_EXIST (FNX) to only set the fields if none of them already exist, RedisHashCommands.HashFieldSetOption.IF_ALL_EXIST (FXX) to only set the fields if all of them already exist, or RedisHashCommands.HashFieldSetOption.UPSERT to set the fields unconditionally.
      expiration - is optional.
      Since:
      4.0
      See Also: