Interface BoundHashOperations<H,HK,HV>

All Superinterfaces:
BoundKeyOperations<H>

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
  • Method Details

    • delete

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

      @Nullable Boolean hasKey(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

      @Nullable HV get(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

      @Nullable List<HV> multiGet(Collection<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

      @Nullable Long increment(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

      @Nullable Double increment(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

      @Nullable HK randomKey()
      Return a random key (aka field) 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

      @Nullable Map.Entry<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

      @Nullable List<HK> randomKeys(long count)
      Return a random keys (aka fields) 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

      @Nullable Map<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

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

      @Nullable Long lengthOfValue(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

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

      void putAll(Map<? extends 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(HK key, HV value)
      Set the value of a hash key at the bound key.
      Parameters:
      key - must not be null.
      value -
    • putIfAbsent

      @Nullable Boolean putIfAbsent(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

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

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

      Cursor<Map.Entry<HK,HV>> scan(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
    • getOperations

      RedisOperations<H,?> getOperations()
      Returns:
      never null.