Interface BoundListOperations<K,V>

All Superinterfaces:
BoundKeyOperations<K>

public interface BoundListOperations<K,V> extends BoundKeyOperations<K>
List operations bound to a certain key.
Author:
Costin Leau, Mark Paluch
  • Method Summary

    Modifier and Type
    Method
    Description
     
    index(long index)
    Get element at index form list at the bound key.
    indexOf(V value)
    Returns the index of the first occurrence of the specified value in the list at at key.
    lastIndexOf(V value)
    Returns the index of the last occurrence of the specified value in the list at at key.
    Removes and returns first element in list stored at the bound key.
    leftPop(long count)
    Removes and returns first elements in list stored at key.
    leftPop(long timeout, TimeUnit unit)
    Removes and returns first element from lists stored at the bound key .
    default V
    leftPop(Duration timeout)
    Removes and returns first element from lists stored at the bound key .
    leftPush(V value)
    Prepend value to the bound key.
    leftPush(V pivot, V value)
    Prepend values to the bound key before value.
    leftPushAll(V... values)
    Prepend values to the bound key.
    Prepend values to the bound key only if the list exists.
    Atomically returns and removes the first/last element (head/tail depending on the from argument) of the list stored at the bound key, and pushes the element at the first/last element (head/tail depending on the to argument) of the list stored at destinationKey.
    move(RedisListCommands.Direction from, K destinationKey, RedisListCommands.Direction to, long timeout, TimeUnit unit)
    Atomically returns and removes the first/last element (head/tail depending on the from argument) of the list stored at the bound key, and pushes the element at the first/last element (head/tail depending on the to argument) of the list stored at destinationKey.
    Atomically returns and removes the first/last element (head/tail depending on the from argument) of the list stored at the bound key, and pushes the element at the first/last element (head/tail depending on the to argument) of the list stored at destinationKey.
    range(long start, long end)
    Get elements between begin and end from list at the bound key.
    remove(long count, Object value)
    Removes the first count occurrences of value from the list stored at the bound key.
    Removes and returns last element in list stored at the bound key.
    rightPop(long count)
    Removes and returns last elements in list stored at key.
    rightPop(long timeout, TimeUnit unit)
    Removes and returns last element from lists stored at the bound key.
    default V
    rightPop(Duration timeout)
    Removes and returns last element from lists stored at the bound key.
    rightPush(V value)
    Append value to the bound key.
    rightPush(V pivot, V value)
    Append values to the bound key before value.
    rightPushAll(V... values)
    Append values to the bound key.
    Append values to the bound key only if the list exists.
    void
    set(long index, V value)
    Set the value list element at index.
    Get the size of list stored at the bound key.
    void
    trim(long start, long end)
    Trim list at the bound key to elements between start and end.

    Methods inherited from interface org.springframework.data.redis.core.BoundKeyOperations

    expire, expire, expireAt, expireAt, getExpire, getKey, getType, persist, rename
  • Method Details

    • range

      @Nullable List<V> range(long start, long end)
      Get elements between begin and end from list at the bound key.
      Parameters:
      start -
      end -
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • trim

      void trim(long start, long end)
      Trim list at the bound key to elements between start and end.
      Parameters:
      start -
      end -
      See Also:
    • size

      @Nullable Long size()
      Get the size of list stored at the bound key.
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • leftPush

      @Nullable Long leftPush(V value)
      Prepend value to the bound key.
      Parameters:
      value -
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • leftPushAll

      @Nullable Long leftPushAll(V... values)
      Prepend values to the bound key.
      Parameters:
      values -
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • leftPushIfPresent

      @Nullable Long leftPushIfPresent(V value)
      Prepend values to the bound key only if the list exists.
      Parameters:
      value -
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • leftPush

      @Nullable Long leftPush(V pivot, V value)
      Prepend values to the bound key before value.
      Parameters:
      value -
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • rightPush

      @Nullable Long rightPush(V value)
      Append value to the bound key.
      Parameters:
      value -
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • rightPushAll

      @Nullable Long rightPushAll(V... values)
      Append values to the bound key.
      Parameters:
      values -
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • rightPushIfPresent

      @Nullable Long rightPushIfPresent(V value)
      Append values to the bound key only if the list exists.
      Parameters:
      value -
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • rightPush

      @Nullable Long rightPush(V pivot, V value)
      Append values to the bound key before value.
      Parameters:
      value -
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • move

      Atomically returns and removes the first/last element (head/tail depending on the from argument) of the list stored at the bound key, and pushes the element at the first/last element (head/tail depending on the to argument) of the list stored at destinationKey.
      Parameters:
      from - must not be null.
      destinationKey - must not be null.
      to - must not be null.
      Returns:
      null when used in pipeline / transaction.
      Since:
      2.6
      See Also:
    • move

      @Nullable V move(RedisListCommands.Direction from, K destinationKey, RedisListCommands.Direction to, Duration timeout)
      Atomically returns and removes the first/last element (head/tail depending on the from argument) of the list stored at the bound key, and pushes the element at the first/last element (head/tail depending on the to argument) of the list stored at destinationKey.

      Blocks connection until element available or timeout reached.

      Parameters:
      from - must not be null.
      destinationKey - must not be null.
      to - must not be null.
      timeout -
      Returns:
      null when used in pipeline / transaction.
      Since:
      2.6
      See Also:
    • move

      @Nullable V move(RedisListCommands.Direction from, K destinationKey, RedisListCommands.Direction to, long timeout, TimeUnit unit)
      Atomically returns and removes the first/last element (head/tail depending on the from argument) of the list stored at the bound key, and pushes the element at the first/last element (head/tail depending on the to argument) of the list stored at destinationKey.

      Blocks connection until element available or timeout reached.

      Parameters:
      from - must not be null.
      destinationKey - must not be null.
      to - must not be null.
      timeout -
      unit -
      Returns:
      null when used in pipeline / transaction.
      Since:
      2.6
      See Also:
    • set

      void set(long index, V value)
      Set the value list element at index.
      Parameters:
      index -
      value -
      See Also:
    • remove

      @Nullable Long remove(long count, Object value)
      Removes the first count occurrences of value from the list stored at the bound key.
      Parameters:
      count -
      value -
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • index

      @Nullable V index(long index)
      Get element at index form list at the bound key.
      Parameters:
      index -
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • indexOf

      Long indexOf(V value)
      Returns the index of the first occurrence of the specified value in the list at at key.
      Requires Redis 6.0.6 or newer.
      Parameters:
      value - must not be null.
      Returns:
      null when used in pipeline / transaction or when not contained in list.
      Since:
      2.4
      See Also:
    • lastIndexOf

      Long lastIndexOf(V value)
      Returns the index of the last occurrence of the specified value in the list at at key.
      Requires Redis 6.0.6 or newer.
      Parameters:
      value - must not be null.
      Returns:
      null when used in pipeline / transaction or when not contained in list.
      Since:
      2.4
      See Also:
    • leftPop

      @Nullable V leftPop()
      Removes and returns first element in list stored at the bound key.
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • leftPop

      @Nullable List<V> leftPop(long count)
      Removes and returns first elements in list stored at key.
      Parameters:
      count -
      Returns:
      can be null.
      Since:
      2.6
      See Also:
    • leftPop

      @Nullable V leftPop(long timeout, TimeUnit unit)
      Removes and returns first element from lists stored at the bound key .
      Blocks connection until element available or timeout reached.
      Parameters:
      timeout -
      unit - must not be null.
      Returns:
      null when timeout reached or used in pipeline / transaction.
      See Also:
    • leftPop

      @Nullable default V leftPop(Duration timeout)
      Removes and returns first element from lists stored at the bound key .
      Blocks connection until element available or timeout reached.
      Parameters:
      timeout - must not be null.
      Returns:
      null when timeout reached or used in pipeline / transaction.
      Throws:
      IllegalArgumentException - if the timeout is null or negative.
      Since:
      2.3
      See Also:
    • rightPop

      @Nullable V rightPop()
      Removes and returns last element in list stored at the bound key.
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • rightPop

      @Nullable List<V> rightPop(long count)
      Removes and returns last elements in list stored at key.
      Parameters:
      count -
      Returns:
      can be null.
      Since:
      2.6
      See Also:
    • rightPop

      @Nullable V rightPop(long timeout, TimeUnit unit)
      Removes and returns last element from lists stored at the bound key.
      Blocks connection until element available or timeout reached.
      Parameters:
      timeout -
      unit - must not be null.
      Returns:
      null when timeout reached or used in pipeline / transaction.
      See Also:
    • rightPop

      @Nullable default V rightPop(Duration timeout)
      Removes and returns last element from lists stored at the bound key.
      Blocks connection until element available or timeout reached.
      Parameters:
      timeout - must not be null.
      Returns:
      null when timeout reached or used in pipeline / transaction.
      Throws:
      IllegalArgumentException - if the timeout is null or negative.
      Since:
      2.3
      See Also:
    • getOperations

      RedisOperations<K,V> getOperations()