Interface BoundValueOperations<K,V>
- All Superinterfaces:
BoundKeyOperations<K>
Value (or String in Redis terminology) operations bound to a certain key.
- Author:
- Costin Leau, Mark Paluch, Jiahe Cai, Christoph Strobl, Marcin Grzejszczak, Yordan Tsintsov
-
Method Summary
Modifier and TypeMethodDescriptionAppend avalueto the bound key.compareAndSet(@NonNull V expectedValue, @NonNull V newValue) Compare the value at the bound key withexpectedValueand set it tonewValueif they are equal.Decrement an integer value stored as string value under the bound key by one.decrement(long delta) Decrement an integer value stored as string value under the bound key bydelta.get()Get the value of the bound key.get(long start, long end) Get a substring of value of the bound key betweenbeginandend.Return the value at the bound key and delete the key.getAndExpire(long timeout, @NonNull TimeUnit unit) Deprecated.getAndExpire(@NonNull Duration timeout) Return the value at the bound key and expire the key by applyingtimeout.getAndExpire(@NonNull Expiration expiration) Return the value at the bound key and expire the key by applyingexpiration.Return the value at the bound key and persist the key.Setvalueof the bound key and return its old value.@NonNull RedisOperations<K, V> Increment an integer value stored as string value under the bound key by one.increment(double delta) Increment a floating point number value stored as string value under the bound key bydelta.increment(long delta) Increment an integer value stored as string value under the bound key bydelta.voidSetvaluefor the bound key.voidOverwrite parts of the bound key starting at the specifiedoffsetwith givenvalue.voidDeprecated.since 4.1 in favor ofset(Object, Expiration).voidSet thevalueand expirationtimeoutfor the bound key.Setvaluefor the bound key and customize the operation throughSetSpec.voidset(@NonNull V value, @NonNull Expiration expiration) Setvalueandexpirationfor the bound key.Deprecated.since 4.1 in favor ofsetGet(Object, Consumer).Set thevalueand expirationtimeoutfor the bound key.Setvaluefor the bound key and customize the operation throughSetSpec.setGet(@NonNull V value, @NonNull Expiration expiration) Set thevalueandexpirationfor the bound key.setIfAbsent(@NonNull V value) Set the bound key to hold the stringvalueif the bound key is absent.setIfAbsent(@NonNull V value, long timeout, @NonNull TimeUnit unit) Deprecated.since 4.1 in favor ofsetIfAbsent(Object, Expiration).setIfAbsent(@NonNull V value, @NonNull Duration timeout) Set bound key to hold the stringvalueand expirationtimeoutif the bound key is absent.setIfAbsent(@NonNull V value, @NonNull Expiration expiration) Set the bound key to hold the stringvalueandexpirationif the bound key is absent.setIfPresent(@NonNull V value) Set the bound key to hold the stringvalueif the bound key is present.setIfPresent(@NonNull V value, long timeout, @NonNull TimeUnit unit) Deprecated.setIfPresent(@NonNull V value, @NonNull Duration timeout) Set the bound key to hold the stringvalueand expirationtimeoutif the bound key is present.setIfPresent(@NonNull V value, @NonNull Expiration expiration) Set the bound key to hold the stringvalueandexpirationif the bound key is present.size()Get the length of the value stored at the bound key.
-
Method Details
-
set
Setvaluefor the bound key.- Parameters:
value- must not be null.- See Also:
-
set
Setvalueandexpirationfor the bound key.- Parameters:
value- must not be null.expiration- must not be null.- Since:
- 4.1
- See Also:
-
set
Deprecated.since 4.1 in favor ofset(Object, Expiration).Set thevalueand expirationtimeoutfor the bound key.- Parameters:
value- must not be null.timeout- must not be null.unit- must not be null.- See Also:
-
set
Set thevalueand expirationtimeoutfor the bound key.- Parameters:
value- must not be null.timeout- must not be null.- Throws:
IllegalArgumentException- if eithervalueortimeoutis not present.- Since:
- 2.1
- See Also:
-
set
Setvaluefor the bound key and customize the operation throughSetSpec.- Parameters:
value- must not be null.setConsumer- a function that consumes theSetSpecto configure the set operation, must not be null.- Returns:
- true if the operation was successful, false otherwise. null when used in pipeline / transaction.
- Since:
- 4.1
- See Also:
-
setGet
Set thevalueandexpirationfor the bound key. 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:
value- must not be null.expiration- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 4.1
- See Also:
-
setGet
Setvaluefor the bound key and customize the operation throughSetSpec. Return the old string stored at key, or null if key did not exist.- Parameters:
value- must not be null.setConsumer- a function that consumes theSetSpecto configure the set operation, must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 4.1
- See Also:
-
setGet
Deprecated.since 4.1 in favor ofsetGet(Object, Consumer).Set thevalueand expirationtimeoutfor the bound key. 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:
value- must not be null.timeout- must not be null.unit- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 3.5
- See Also:
-
setGet
Set thevalueand expirationtimeoutfor the bound key. 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:
value- must not be null.timeout- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 3.5
- See Also:
-
setIfAbsent
-
setIfAbsent
Set the bound key to hold the stringvalueandexpirationif the bound key is absent.- Parameters:
value- must not be null.expiration- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 4.1
- See Also:
-
setIfAbsent
@Deprecated(since="4.1") Boolean setIfAbsent(@NonNull V value, long timeout, @NonNull TimeUnit unit) Deprecated.since 4.1 in favor ofsetIfAbsent(Object, Expiration).Set the bound key to hold the stringvalueand expirationtimeoutif the bound key is absent.- Parameters:
value- must not be null.timeout- must not be null.unit- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.1
- See Also:
-
setIfAbsent
Set bound key to hold the stringvalueand expirationtimeoutif the bound key is absent.- Parameters:
value- must not be null.timeout- must not be null.- Returns:
- null when used in pipeline / transaction.
- Throws:
IllegalArgumentException- if eithervalueortimeoutis not present.- Since:
- 2.1
- See Also:
-
setIfPresent
Set the bound key to hold the stringvalueif the bound key is present.- Parameters:
value- must not be null.- Returns:
- command result indicating if the key has been set.
- Throws:
IllegalArgumentException- ifvalueis not present.- Since:
- 2.1
- See Also:
-
setIfPresent
Set the bound key to hold the stringvalueandexpirationif the bound key is present.- Parameters:
value- must not be null.expiration- must not be null.- Returns:
- command result indicating if the key has been set.
- Since:
- 4.1
- See Also:
-
setIfPresent
@Deprecated(since="4.1") Boolean setIfPresent(@NonNull V value, long timeout, @NonNull TimeUnit unit) Deprecated.Set the bound key to hold the stringvalueand expirationtimeoutif the bound key is present.- Parameters:
value- must not be null.timeout- must not be null.unit- must not be null.- Returns:
- command result indicating if the key has been set.
- Throws:
IllegalArgumentException- if eithervalueortimeoutis not present.- Since:
- 2.1
- See Also:
-
setIfPresent
Set the bound key to hold the stringvalueand expirationtimeoutif the bound key is present.- Parameters:
value- must not be null.timeout- must not be null.- Returns:
- null when used in pipeline / transaction.
- Throws:
IllegalArgumentException- if eithervalueortimeoutis not present.- Since:
- 2.1
- See Also:
-
compareAndSet
Compare the value at the bound key withexpectedValueand set it tonewValueif they are equal.- Parameters:
expectedValue- the expected current value, must not be null.newValue- the new value to set if comparison succeeds, must not be null.- Returns:
- true if the operation was successful, false otherwise. null when used in pipeline / transaction.
- Since:
- 4.1
- See Also:
-
get
V get()Get the value of the bound key.- Returns:
- null when key does not exist or used in pipeline / transaction.
- See Also:
-
getAndDelete
V getAndDelete()Return the value at the bound key and delete the key.- Returns:
- null when key does not exist or used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
getAndExpire
Return the value at the bound key and expire the key by applyingexpiration.- Parameters:
expiration- must not be null.- Returns:
- null when key does not exist or used in pipeline / transaction.
- Since:
- 4.1
- See Also:
-
getAndExpire
Deprecated.since 4.1 in favor ofgetAndExpire(Expiration).Return the value at the bound key and expire the key by applyingtimeout.- Parameters:
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
V getAndPersist()Return the value at the bound key and persist the key. This operation removes any TTL that is associated with the bound key.- Returns:
- null when key does not exist or used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
getAndSet
-
increment
Long increment()Increment an integer value stored as string value under the bound key by one.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.1
- See Also:
-
increment
Increment an integer value stored as string value under the bound key bydelta.- Parameters:
delta-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
increment
Increment a floating point number value stored as string value under the bound key bydelta.- Parameters:
delta-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
decrement
Long decrement()Decrement an integer value stored as string value under the bound key by one.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.1
- See Also:
-
decrement
Decrement an integer value stored as string value under the bound key bydelta.- Parameters:
delta-- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.1
- See Also:
-
append
-
get
Get a substring of value of the bound key betweenbeginandend.- Parameters:
start-end-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
set
Overwrite parts of the bound key starting at the specifiedoffsetwith givenvalue.- Parameters:
value- must not be null.offset-- See Also:
-
size
Long size()Get the length of the value stored at the bound key.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
getOperations
@NonNull RedisOperations<K,V> getOperations()- Specified by:
getOperationsin interfaceBoundKeyOperations<K>- Returns:
- the underlying
RedisOperationsused to execute commands.
-
getAndExpire(Expiration).