Interface BoundValueOperations<K,V>

All Superinterfaces:
BoundKeyOperations<K>

@NullUnmarked public interface BoundValueOperations<K,V> extends 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
  • Method Summary

    Modifier and Type
    Method
    Description
    append(@NonNull String value)
    Append a value to the bound key.
    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 by delta.
    get()
    Get the value of the bound key.
    get(long start, long end)
    Get a substring of value of the bound key between begin and end.
    Return the value at the bound key and delete the key.
    getAndExpire(long timeout, @NonNull TimeUnit unit)
    Return the value at the bound key and expire the key by applying timeout.
    getAndExpire(@NonNull Duration timeout)
    Return the value at the bound key and expire the key by applying timeout.
    Return the value at the bound key and persist the key.
    getAndSet(@NonNull V value)
    Set value of 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 by delta.
    increment(long delta)
    Increment an integer value stored as string value under the bound key by delta.
    void
    set(@NonNull V value)
    Set value for the bound key.
    void
    set(@NonNull V value, long offset)
    Overwrite parts of the bound key starting at the specified offset with given value.
    void
    set(@NonNull V value, long timeout, @NonNull TimeUnit unit)
    Set the value and expiration timeout for the bound key.
    default void
    set(@NonNull V value, @NonNull Duration timeout)
    Set the value and expiration timeout for the bound key.
    setGet(@NonNull V value, long timeout, @NonNull TimeUnit unit)
    Set the value and expiration timeout for the bound key.
    setGet(@NonNull V value, @NonNull Duration duration)
    Set the value and expiration timeout for the bound key.
    setIfAbsent(@NonNull V value)
    Set the bound key to hold the string value if the bound key is absent.
    setIfAbsent(@NonNull V value, long timeout, @NonNull TimeUnit unit)
    Set the bound key to hold the string value and expiration timeout if the bound key is absent.
    default Boolean
    setIfAbsent(@NonNull V value, @NonNull Duration timeout)
    Set bound key to hold the string value and expiration timeout if the bound key is absent.
    setIfPresent(@NonNull V value)
    Set the bound key to hold the string value if the bound key is present.
    setIfPresent(@NonNull V value, long timeout, @NonNull TimeUnit unit)
    Set the bound key to hold the string value and expiration timeout if the bound key is present.
    default Boolean
    setIfPresent(@NonNull V value, @NonNull Duration timeout)
    Set the bound key to hold the string value and expiration timeout if the bound key is present.
    Get the length of the value stored at the bound key.
  • Method Details

    • set

      void set(@NonNull V value)
      Set value for the bound key.
      Parameters:
      value - must not be null.
      See Also:
    • set

      void set(@NonNull V value, long timeout, @NonNull TimeUnit unit)
      Set the value and expiration timeout for the bound key.
      Parameters:
      value - must not be null.
      timeout -
      unit - must not be null.
      See Also:
    • setGet

      V setGet(@NonNull V value, long timeout, @NonNull TimeUnit unit)
      Set the value and expiration timeout for 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 -
      unit - must not be null.
      Returns:
      null when used in pipeline / transaction.
      Since:
      3.5
      See Also:
    • setGet

      V setGet(@NonNull V value, @NonNull Duration duration)
      Set the value and expiration timeout for 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.
      duration - expiration duration
      Returns:
      null when used in pipeline / transaction.
      Since:
      3.5
      See Also:
    • set

      default void set(@NonNull V value, @NonNull Duration timeout)
      Set the value and expiration timeout for the bound key.
      Parameters:
      value - must not be null.
      timeout - must not be null.
      Throws:
      IllegalArgumentException - if either value or timeout is not present.
      Since:
      2.1
      See Also:
    • setIfAbsent

      Boolean setIfAbsent(@NonNull V value)
      Set the bound key to hold the string value if the bound key is absent.
      Parameters:
      value - must not be null.
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • setIfAbsent

      Boolean setIfAbsent(@NonNull V value, long timeout, @NonNull TimeUnit unit)
      Set the bound key to hold the string value and expiration timeout if the bound key is absent.
      Parameters:
      value - must not be null.
      timeout -
      unit - must not be null.
      Returns:
      null when used in pipeline / transaction.
      Since:
      2.1
      See Also:
    • setIfAbsent

      default Boolean setIfAbsent(@NonNull V value, @NonNull Duration timeout)
      Set bound key to hold the string value and expiration timeout if 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 either value or timeout is not present.
      Since:
      2.1
      See Also:
    • setIfPresent

      Boolean setIfPresent(@NonNull V value)
      Set the bound key to hold the string value if the bound key is present.
      Parameters:
      value - must not be null.
      Returns:
      command result indicating if the key has been set.
      Throws:
      IllegalArgumentException - if value is not present.
      Since:
      2.1
      See Also:
    • setIfPresent

      Boolean setIfPresent(@NonNull V value, long timeout, @NonNull TimeUnit unit)
      Set the bound key to hold the string value and expiration timeout if the bound key is present.
      Parameters:
      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 either value or timeout is not present.
      Since:
      2.1
      See Also:
    • setIfPresent

      default Boolean setIfPresent(@NonNull V value, @NonNull Duration timeout)
      Set the bound key to hold the string value and expiration timeout if 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 either value or timeout is not present.
      Since:
      2.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

      V getAndExpire(long timeout, @NonNull TimeUnit unit)
      Return the value at the bound key and expire the key by applying timeout.
      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

      V getAndExpire(@NonNull Duration timeout)
      Return the value at the bound key and expire the key by applying timeout.
      Parameters:
      timeout - must not be null.
      Returns:
      null when key does not exist or used in pipeline / transaction.
      Since:
      2.6
      See Also:
    • 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

      V getAndSet(@NonNull V value)
      Set value of the bound key and return its old value.
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • 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

      Long increment(long delta)
      Increment an integer value stored as string value under the bound key by delta.
      Parameters:
      delta -
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • increment

      Double increment(double delta)
      Increment a floating point number value stored as string value under the bound key by delta.
      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

      Long decrement(long delta)
      Decrement an integer value stored as string value under the bound key by delta.
      Parameters:
      delta -
      Returns:
      null when used in pipeline / transaction.
      Since:
      2.1
      See Also:
    • append

      Integer append(@NonNull String value)
      Append a value to the bound key.
      Parameters:
      value - must not be null.
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • get

      String get(long start, long end)
      Get a substring of value of the bound key between begin and end.
      Parameters:
      start -
      end -
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • set

      void set(@NonNull V value, long offset)
      Overwrite parts of the bound key starting at the specified offset with given value.
      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:
      getOperations in interface BoundKeyOperations<K>
      Returns:
      the underlying RedisOperations used to execute commands.