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 avaluetokey.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 underkeyby one.Decrement an integer value stored as string value underkeybydelta.Get the value ofkey.Get a substring of value ofkeybetweenbeginandend.getAndDelete(K key) Return the value atkeyand delete the key.getAndExpire(K key, long timeout, TimeUnit unit) Return the value atkeyand expire the key by applyingtimeout.getAndExpire(K key, Duration timeout) Return the value atkeyand expire the key by applyingtimeout.getAndPersist(K key) Return the value atkeyand persist the key.Setvalueofkeyand return its old value.Get the bit value atoffsetof value atkey.Increment an integer value stored as string value underkeyby one.Increment a floating point number value stored as string value underkeybydelta.Increment an integer value stored as string value underkeybydelta.multiGet(Collection<K> keys) Get multiplekeys.voidSet 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 intupleonly if the provided key does not exist.voidSetvalueforkey.voidOverwrite parts ofkeystarting at the specifiedoffsetwith givenvalue.voidSet thevalueand expirationtimeoutforkey.default voidSet thevalueand expirationtimeoutforkey.Sets the bit atoffsetin value stored atkey.setIfAbsent(K key, V value) Setkeyto hold the stringvalueifkeyis absent.setIfAbsent(K key, V value, long timeout, TimeUnit unit) Setkeyto hold the stringvalueand expirationtimeoutifkeyis absent.default BooleansetIfAbsent(K key, V value, Duration timeout) Setkeyto hold the stringvalueand expirationtimeoutifkeyis absent.setIfPresent(K key, V value) Setkeyto hold the stringvalueifkeyis present.setIfPresent(K key, V value, long timeout, TimeUnit unit) Setkeyto hold the stringvalueand expirationtimeoutifkeyis present.default BooleansetIfPresent(K key, V value, Duration timeout) Setkeyto hold the stringvalueand expirationtimeoutifkeyis present.Get the length of the value stored atkey.
-
Method Details
-
set
Setvalueforkey.- Parameters:
key- must not be null.value- must not be null.- See Also:
-
set
Set thevalueand expirationtimeoutforkey.- 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 thevalueand expirationtimeoutforkey.- Parameters:
key- must not be null.value- must not be null.timeout- must not be null.- Throws:
IllegalArgumentException- if eitherkey,valueortimeoutis not present.- Since:
- 2.1
- See Also:
-
setIfAbsent
Setkeyto hold the stringvalueifkeyis absent.- Parameters:
key- must not be null.value- must not be null.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
setIfAbsent
Setkeyto hold the stringvalueand expirationtimeoutifkeyis 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
Setkeyto hold the stringvalueand expirationtimeoutifkeyis 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,valueortimeoutis not present.- Since:
- 2.1
- See Also:
-
setIfPresent
Setkeyto hold the stringvalueifkeyis 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 eitherkeyorvalueis not present.- Since:
- 2.1
- See Also:
-
setIfPresent
Setkeyto hold the stringvalueand expirationtimeoutifkeyis 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,valueortimeoutis not present.- Since:
- 2.1
- See Also:
-
setIfPresent
Setkeyto hold the stringvalueand expirationtimeoutifkeyis 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,valueortimeoutis 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 intupleonly 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 atkeyand 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 atkeyand 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 atkeyand 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 atkeyand 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
Setvalueofkeyand 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 using null 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 underkeyby 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 underkeybydelta.- 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 underkeybydelta.- 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 underkeyby 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 underkeybydelta.- Parameters:
key- must not be null.delta-- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.1
- See Also:
-
append
Append avaluetokey.- Parameters:
key- must not be null.value-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
get
Get a substring of value ofkeybetweenbeginandend.- Parameters:
key- must not be null.start-end-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
set
Overwrite parts ofkeystarting at the specifiedoffsetwith 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 atoffsetin 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 atoffsetof 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()
-