Interface BoundListOperations<K,V>

All Superinterfaces:
BoundKeyOperations<K>

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

    • range

      List<V> range(long start, long end)
      Get elements between start 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

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

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

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

      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

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

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

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

      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

      Long rightPush(@NonNull 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

      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

      V move(@NonNull RedisListCommands.Direction from, @NonNull K destinationKey, @NonNull RedisListCommands.Direction to, long timeout, @NonNull 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

      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:
    • getFirst

      V getFirst()
      Returns the first element from the list at the bound key.
      Returns:
      null when used in pipeline / transaction.
      Since:
      3.4
    • getLast

      V getLast()
      Returns the last element from the list at the bound key.
      Returns:
      null when used in pipeline / transaction.
      Since:
      3.4
    • index

      V index(long index)
      Get element at index from 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 the bound 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 the bound 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

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

      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

      V leftPop(long timeout, @NonNull 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

      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

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

      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

      V rightPop(long timeout, @NonNull 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

      default V rightPop(@NonNull 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

      @NonNull RedisOperations<K,V> getOperations()
      Specified by:
      getOperations in interface BoundKeyOperations<K>
      Returns:
      the underlying RedisOperations used to execute commands.