Interface ValueOperations<K,V>
Redis operations for simple (or in Redis terminology 'string') values.
- Author:
- Costin Leau, Christoph Strobl, Mark Paluch, Jiahe Cai, Marcin Grzejszczak, Chris Bono, JaeGeun Lee
-
Method Summary
Modifier and TypeMethodDescriptionAppend avaluetokey.bitField(@NonNull K key, @NonNull 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 a substring of value ofkeybetweenstartandend.Get the value ofkey.getAndDelete(@NonNull K key) Return the value atkeyand delete the key.getAndExpire(@NonNull K key, long timeout, @NonNull TimeUnit unit) Return the value atkeyand expire the key by applyingtimeout.getAndExpire(@NonNull K key, @NonNull Duration timeout) Return the value atkeyand expire the key by applyingtimeout.getAndPersist(@NonNull 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(@NonNull Collection<@NonNull K> keys) Get multiplekeys.voidSet multiple keys to multiple values using key-value pairs provided intuple.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.Set thevalueand expirationtimeoutforkey.Set thevalueand expirationtimeoutforkey.setIfAbsent(@NonNull K key, @NonNull V value) Setkeyto hold the stringvalueifkeyis absent.Setkeyto hold the stringvalueand expirationtimeoutifkeyis absent.default BooleanSetkeyto hold the stringvalueand expirationtimeoutifkeyis absent.setIfPresent(@NonNull K key, @NonNull V value) Setkeyto hold the stringvalueifkeyis present.Setkeyto hold the stringvalueand expirationtimeoutifkeyis present.default BooleanSetkeyto hold the stringvalueand expirationtimeoutifkeyis present.Get the length of the value stored atkey.
-
Method Details
-
set
-
setGet
Set thevalueand expirationtimeoutforkey. Return the old string stored at key, or null if key did not exist. An error is returned and SET aborted if the value stored at key is not a string.- 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:
- 3.5
- See Also:
-
setGet
Set thevalueand expirationtimeoutforkey. Return the old string stored at key, or null if key did not exist. An error is returned and SET aborted if the value stored at key is not a string.- Parameters:
key- must not be null.value- must not be null.duration- expiration duration- Returns:
- null when used in pipeline / transaction.
- Since:
- 3.5
- See Also:
-
set
-
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
-
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
-
multiSetIfAbsent
-
get
-
getAndDelete
-
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
-
getAndPersist
-
getAndSet
-
multiGet
-
increment
-
increment
-
increment
-
decrement
-
decrement
-
append
-
get
-
set
-
size
-
setBit
-
getBit
-
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
@NonNull RedisOperations<K,V> getOperations()- Returns:
- the underlying
RedisOperationsused to execute commands.
-