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 hashkeys
at the bound key.entries()
Get entire hash at the bound key.Get value for givenkey
from the hash at the bound key.RedisOperations<H,
?> Determine if given hashkey
exists at the bound key.Incrementvalue
of a hashkey
by the givendelta
at the bound key.Incrementvalue
of a hashkey
by the givendelta
at 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 givenkeys
from the hash at the bound key.void
Set thevalue
of a hashkey
at the bound key.void
Set multiple hash fields to multiple values using data provided inm
at the bound key.putIfAbsent
(HK key, HV value) Set thevalue
of a hashkey
only ifkey
does 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 aCursor
to 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 hashkeys
at the bound key.- Parameters:
keys
- must not be null.- Returns:
- null when used in pipeline / transaction.
-
hasKey
Determine if given hashkey
exists at the bound key.- Parameters:
key
- must not be null.- Returns:
- null when used in pipeline / transaction.
-
get
Get value for givenkey
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
Get values for givenkeys
from the hash at the bound key. Values are in the order of the requested keys Absent field values are represented usingnull
in the resultingList
.- Parameters:
keys
- must not be null.- Returns:
- null when used in pipeline / transaction.
-
increment
Incrementvalue
of a hashkey
by the givendelta
at the bound key.- Parameters:
key
- must not be null.delta
-- Returns:
- null when used in pipeline / transaction.
-
increment
Incrementvalue
of a hashkey
by the givendelta
at 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 providedcount
argument is positive, return a list of distinct keys, capped either atcount
or the hash size. Ifcount
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
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 thehashKey
do not exist,0
is 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 inm
at the bound key.- Parameters:
m
- must not be null.
-
put
Set thevalue
of a hashkey
at the bound key.- Parameters:
key
- must not be null.value
-
-
putIfAbsent
Set thevalue
of a hashkey
only ifkey
does 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 aCursor
to 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.
-