Interface ValueOperations<K,V>
public interface ValueOperations<K,V>
Redis operations for simple (or in Redis terminology 'string') values.
- Author:
- Costin Leau, Christoph Strobl, Mark Paluch, Jiahe Cai
-
Method Summary
Modifier and TypeMethodDescriptionAppend avalue
tokey
.bitField
(K key, BitFieldSubCommands subCommands) Get / Manipulate specific integer fields of varying bit widths and arbitrary non (necessary) aligned offset stored at a givenkey
.Decrement an integer value stored as string value underkey
by one.Decrement an integer value stored as string value underkey
bydelta
.Get the value ofkey
.Get a substring of value ofkey
betweenbegin
andend
.getAndDelete
(K key) Return the value atkey
and delete the key.getAndExpire
(K key, long timeout, TimeUnit unit) Return the value atkey
and expire the key by applyingtimeout
.getAndExpire
(K key, Duration timeout) Return the value atkey
and expire the key by applyingtimeout
.getAndPersist
(K key) Return the value atkey
and persist the key.Setvalue
ofkey
and return its old value.Get the bit value atoffset
of value atkey
.Increment an integer value stored as string value underkey
by one.Increment a floating point number value stored as string value underkey
bydelta
.Increment an integer value stored as string value underkey
bydelta
.multiGet
(Collection<K> keys) Get multiplekeys
.void
Set multiple keys to multiple values using key-value pairs provided intuple
.multiSetIfAbsent
(Map<? extends K, ? extends V> map) Set multiple keys to multiple values using key-value pairs provided intuple
only if the provided key does not exist.void
Setvalue
forkey
.void
Overwrite parts ofkey
starting at the specifiedoffset
with givenvalue
.void
Set thevalue
and expirationtimeout
forkey
.default void
Set thevalue
and expirationtimeout
forkey
.Sets the bit atoffset
in value stored atkey
.setIfAbsent
(K key, V value) Setkey
to hold the stringvalue
ifkey
is absent.setIfAbsent
(K key, V value, long timeout, TimeUnit unit) Setkey
to hold the stringvalue
and expirationtimeout
ifkey
is absent.default Boolean
setIfAbsent
(K key, V value, Duration timeout) Setkey
to hold the stringvalue
and expirationtimeout
ifkey
is absent.setIfPresent
(K key, V value) Setkey
to hold the stringvalue
ifkey
is present.setIfPresent
(K key, V value, long timeout, TimeUnit unit) Setkey
to hold the stringvalue
and expirationtimeout
ifkey
is present.default Boolean
setIfPresent
(K key, V value, Duration timeout) Setkey
to hold the stringvalue
and expirationtimeout
ifkey
is present.Get the length of the value stored atkey
.
-
Method Details
-
set
Setvalue
forkey
.- Parameters:
key
- must not be null.value
- must not be null.- See Also:
-
set
Set thevalue
and expirationtimeout
forkey
.- Parameters:
key
- must not be null.value
- must not be null.timeout
- the key expiration timeout.unit
- must not be null.- See Also:
-
set
Set thevalue
and expirationtimeout
forkey
.- Parameters:
key
- must not be null.value
- must not be null.timeout
- must not be null.- Throws:
IllegalArgumentException
- if eitherkey
,value
ortimeout
is not present.- Since:
- 2.1
- See Also:
-
setIfAbsent
Setkey
to hold the stringvalue
ifkey
is absent.- Parameters:
key
- must not be null.value
- must not be null.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
setIfAbsent
Setkey
to hold the stringvalue
and expirationtimeout
ifkey
is absent.- Parameters:
key
- must not be null.value
- must not be null.timeout
- the key expiration timeout.unit
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.1
- See Also:
-
setIfAbsent
Setkey
to hold the stringvalue
and expirationtimeout
ifkey
is absent.- Parameters:
key
- must not be null.value
- must not be null.timeout
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Throws:
IllegalArgumentException
- if eitherkey
,value
ortimeout
is not present.- Since:
- 2.1
- See Also:
-
setIfPresent
Setkey
to hold the stringvalue
ifkey
is present.- Parameters:
key
- must not be null.value
- must not be null.- Returns:
- command result indicating if the key has been set.
- Throws:
IllegalArgumentException
- if eitherkey
orvalue
is not present.- Since:
- 2.1
- See Also:
-
setIfPresent
Setkey
to hold the stringvalue
and expirationtimeout
ifkey
is present.- Parameters:
key
- must not be null.value
- must not be null.timeout
- the key expiration timeout.unit
- must not be null.- Returns:
- command result indicating if the key has been set.
- Throws:
IllegalArgumentException
- if eitherkey
,value
ortimeout
is not present.- Since:
- 2.1
- See Also:
-
setIfPresent
Setkey
to hold the stringvalue
and expirationtimeout
ifkey
is present.- Parameters:
key
- must not be null.value
- must not be null.timeout
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Throws:
IllegalArgumentException
- if eitherkey
,value
ortimeout
is not present.- Since:
- 2.1
- See Also:
-
multiSet
Set multiple keys to multiple values using key-value pairs provided intuple
.- Parameters:
map
- must not be null.- See Also:
-
multiSetIfAbsent
Set multiple keys to multiple values using key-value pairs provided intuple
only if the provided key does not exist.- Parameters:
map
- must not be null.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
get
Get the value ofkey
.- Parameters:
key
- must not be null.- Returns:
- null when key does not exist or used in pipeline / transaction.
- See Also:
-
getAndDelete
Return the value atkey
and delete the key.- Parameters:
key
- must not be null.- Returns:
- null when key does not exist or used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
getAndExpire
Return the value atkey
and expire the key by applyingtimeout
.- Parameters:
key
- must not be null.timeout
-unit
- must not be null.- Returns:
- null when key does not exist or used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
getAndExpire
Return the value atkey
and expire the key by applyingtimeout
.- Parameters:
key
- must not be null.timeout
- must not be null.- Returns:
- null when key does not exist or used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
getAndPersist
Return the value atkey
and persist the key. This operation removes any TTL that is associated withkey
.- Parameters:
key
- must not be null.- Returns:
- null when key does not exist or used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
getAndSet
Setvalue
ofkey
and return its old value.- Parameters:
key
- must not be null.- Returns:
- null when key does not exist or used in pipeline / transaction.
- See Also:
-
multiGet
Get multiplekeys
. 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.
- See Also:
-
increment
Increment an integer value stored as string value underkey
by one.- Parameters:
key
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.1
- See Also:
-
increment
Increment an integer value stored as string value underkey
bydelta
.- Parameters:
key
- must not be null.delta
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
increment
Increment a floating point number value stored as string value underkey
bydelta
.- Parameters:
key
- must not be null.delta
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
decrement
Decrement an integer value stored as string value underkey
by one.- Parameters:
key
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.1
- See Also:
-
decrement
Decrement an integer value stored as string value underkey
bydelta
.- Parameters:
key
- must not be null.delta
-- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.1
- See Also:
-
append
Append avalue
tokey
.- Parameters:
key
- must not be null.value
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
get
Get a substring of value ofkey
betweenbegin
andend
.- Parameters:
key
- must not be null.start
-end
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
set
Overwrite parts ofkey
starting at the specifiedoffset
with givenvalue
.- Parameters:
key
- must not be null.value
-offset
-- See Also:
-
size
Get the length of the value stored atkey
.- Parameters:
key
- must not be null.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
setBit
Sets the bit atoffset
in value stored atkey
.- Parameters:
key
- must not be null.offset
-value
-- Returns:
- null when used in pipeline / transaction.
- Since:
- 1.5
- See Also:
-
getBit
Get the bit value atoffset
of value atkey
.- Parameters:
key
- must not be null.offset
-- Returns:
- null when used in pipeline / transaction.
- Since:
- 1.5
- See Also:
-
bitField
Get / Manipulate specific integer fields of varying bit widths and arbitrary non (necessary) aligned offset stored at a givenkey
.- Parameters:
key
- must not be null.subCommands
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.1
- See Also:
-
getOperations
RedisOperations<K,V> getOperations()
-