Interface ValueOperations<K,V>
@NullUnmarked
public 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
-
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 ofkeybetweenbeginandend.@Nullable VGet the value ofkey.@Nullable VgetAndDelete(@NonNull K key) Return the value atkeyand delete the key.@Nullable VgetAndExpire(@NonNull K key, long timeout, @NonNull TimeUnit unit) Return the value atkeyand expire the key by applyingtimeout.@Nullable VgetAndExpire(@NonNull K key, @NonNull Duration timeout) Return the value atkeyand expire the key by applyingtimeout.@Nullable VgetAndPersist(@NonNull K key) Return the value atkeyand persist the key.@Nullable VSetvalueofkeyand return its old value.Get the bit value atoffsetof value atkey.@NonNull RedisOperations<K, V> 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.multiSetIfAbsent(Map<? extends @NonNull K, ? extends @NonNull 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.@Nullable VSet thevalueand expirationtimeoutforkey.@Nullable VSet thevalueand expirationtimeoutforkey.setIfAbsent(@NonNull K key, @NonNull V value) Setkeyto hold the stringvalueifkeyis absent.setIfAbsent(@NonNull K key, @NonNull V value, long timeout, @NonNull TimeUnit unit) Setkeyto hold the stringvalueand expirationtimeoutifkeyis absent.default BooleansetIfAbsent(@NonNull K key, @NonNull V value, @NonNull Duration timeout) Setkeyto hold the stringvalueand expirationtimeoutifkeyis absent.setIfPresent(@NonNull K key, @NonNull V value) Setkeyto hold the stringvalueifkeyis present.setIfPresent(@NonNull K key, @NonNull V value, long timeout, @NonNull TimeUnit unit) Setkeyto hold the stringvalueand expirationtimeoutifkeyis present.default BooleansetIfPresent(@NonNull K key, @NonNull V value, @NonNull Duration timeout) Setkeyto 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
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
-
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.
-