Interface BoundHashOperations<H,HK,HV>
- All Superinterfaces:
BoundKeyOperations<H>
Hash operations bound to a certain key.
- Author:
- Costin Leau, Christoph Strobl, Ninad Divadkar, Mark Paluch
-
Method Summary
Modifier and TypeMethodDescriptionDelete given hashkeysat the bound key.entries()Get entire hash at the bound key.Get value for givenkeyfrom the hash at the bound key.RedisOperations<H,?> Determine if given hashkeyexists at the bound key.Incrementvalueof a hashkeyby the givendeltaat the bound key.Incrementvalueof a hashkeyby the givendeltaat the bound key.keys()Get key set (fields) of hash at the bound key.lengthOfValue(HK hashKey) Returns the length of the value associated withhashKey.multiGet(Collection<HK> keys) Get values for givenkeysfrom the hash at the bound key.voidSet thevalueof a hashkeyat the bound key.voidSet multiple hash fields to multiple values using data provided inmat the bound key.putIfAbsent(HK key, HV value) Set thevalueof a hashkeyonly ifkeydoes not exist.randomEntries(long count) Return a random entry from the hash stored at the bound key.Return a random entry from the hash stored at the bound key.Return a random key (aka field) from the hash stored at the bound key.randomKeys(long count) Return a random keys (aka fields) from the hash stored at the bound key.scan(ScanOptions options) Use aCursorto iterate over entries in hash at the bound key.size()Get size of hash at the bound key.values()Get entry set (values) of hash at the bound key.
-
Method Details
-
delete
Delete given hashkeysat the bound key.- Parameters:
keys- must not be null.- Returns:
- null when used in pipeline / transaction.
-
hasKey
Determine if given hashkeyexists at the bound key.- Parameters:
key- must not be null.- Returns:
- null when used in pipeline / transaction.
-
get
Get value for givenkeyfrom 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
Get values for givenkeysfrom the hash at the bound key. Values are in the order of the requested keys Absent field values are represented using null in the resultingList.- Parameters:
keys- must not be null.- Returns:
- null when used in pipeline / transaction.
-
increment
Incrementvalueof a hashkeyby the givendeltaat the bound key.- Parameters:
key- must not be null.delta-- Returns:
- null when used in pipeline / transaction.
-
increment
Incrementvalueof a hashkeyby the givendeltaat the bound key.- Parameters:
key- must not be null.delta-- Returns:
- null when used in pipeline / transaction.
-
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
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
Return a random keys (aka fields) from the hash stored at the bound key. If the providedcountargument is positive, return a list of distinct keys, capped either atcountor the hash size. Ifcountis 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
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
Get key set (fields) of hash at the bound key.- Returns:
- null when used in pipeline / transaction.
-
lengthOfValue
Returns the length of the value associated withhashKey. If thehashKeydo not exist,0is returned.- Parameters:
hashKey- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.1
-
size
Get size of hash at the bound key.- Returns:
- null when used in pipeline / transaction.
-
putAll
Set multiple hash fields to multiple values using data provided inmat the bound key.- Parameters:
m- must not be null.
-
put
Set thevalueof a hashkeyat the bound key.- Parameters:
key- must not be null.value-
-
putIfAbsent
Set thevalueof a hashkeyonly ifkeydoes not exist.- Parameters:
key- must not be null.value-- Returns:
- null when used in pipeline / transaction.
-
values
Get entry set (values) of hash at the bound key.- Returns:
- null when used in pipeline / transaction.
-
entries
Get entire hash at the bound key.- Returns:
- null when used in pipeline / transaction.
-
scan
Use aCursorto iterate over entries in hash at the bound key.
Important: CallCloseableIterator.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.
-