Class ValkeyGlideListCommands

java.lang.Object
io.valkey.springframework.data.valkey.connection.valkeyglide.ValkeyGlideListCommands
All Implemented Interfaces:
ValkeyListCommands

public class ValkeyGlideListCommands extends Object implements ValkeyListCommands
Implementation of ValkeyListCommands for Valkey-Glide.
Since:
2.0
Author:
Ilia Kolominsky
  • Nested Class Summary

    Nested classes/interfaces inherited from interface io.valkey.springframework.data.valkey.connection.ValkeyListCommands

    ValkeyListCommands.Direction, ValkeyListCommands.Position
  • Constructor Summary

    Constructors
    Constructor
    Description
  • Method Summary

    Modifier and Type
    Method
    Description
    @org.jspecify.annotations.Nullable byte[]
    bLMove(byte[] sourceKey, byte[] destinationKey, ValkeyListCommands.Direction from, ValkeyListCommands.Direction to, double timeout)
    Atomically returns and removes the first/last element (head/tail depending on the from argument) of the list stored at sourceKey, and pushes the element at the first/last element (head/tail depending on the to argument) of the list stored at destinationKey.
    @Nullable List<byte[]>
    bLPop(int timeout, byte[]... keys)
    Removes and returns first element from lists stored at keys.
    @Nullable List<byte[]>
    bRPop(int timeout, byte[]... keys)
    Removes and returns last element from lists stored at keys.
    @org.jspecify.annotations.Nullable byte[]
    bRPopLPush(int timeout, byte[] srcKey, byte[] dstKey)
    Remove the last element from list at srcKey, append it to dstKey and return its value.
    @org.jspecify.annotations.Nullable byte[]
    lIndex(byte[] key, long index)
    Get element at index form list at key.
    @Nullable Long
    lInsert(byte[] key, ValkeyListCommands.Position where, byte[] pivot, byte[] value)
    @Nullable Long
    lLen(byte[] key)
    Get the size of list stored at key.
    @org.jspecify.annotations.Nullable byte[]
    lMove(byte[] sourceKey, byte[] destinationKey, ValkeyListCommands.Direction from, ValkeyListCommands.Direction to)
    Atomically returns and removes the first/last element (head/tail depending on the from argument) of the list stored at sourceKey, and pushes the element at the first/last element (head/tail depending on the to argument) of the list stored at destinationKey.
    @org.jspecify.annotations.Nullable byte[]
    lPop(byte[] key)
    Removes and returns first element in list stored at key.
    @Nullable List<byte[]>
    lPop(byte[] key, long count)
    Removes and returns first elements in list stored at key.
    @Nullable List<Long>
    lPos(byte[] key, byte[] element, @Nullable Integer rank, @Nullable Integer count)
    Returns the index of matching elements inside the list stored at given key.
    @Nullable Long
    lPush(byte[] key, byte[]... values)
    Prepend values to key.
    @Nullable Long
    lPushX(byte[] key, byte[] value)
    Prepend values to key only if the list exists.
    @Nullable List<byte[]>
    lRange(byte[] key, long start, long end)
    Get elements between start and end from list at key.
    @Nullable Long
    lRem(byte[] key, long count, byte[] value)
    Removes the first count occurrences of value from the list stored at key.
    void
    lSet(byte[] key, long index, byte[] value)
    Set the value list element at index.
    void
    lTrim(byte[] key, long start, long end)
    Trim list at key to elements between start and end.
    @org.jspecify.annotations.Nullable byte[]
    rPop(byte[] key)
    Removes and returns last element in list stored at key.
    @Nullable List<byte[]>
    rPop(byte[] key, long count)
    Removes and returns last elements in list stored at key.
    @org.jspecify.annotations.Nullable byte[]
    rPopLPush(byte[] srcKey, byte[] dstKey)
    Remove the last element from list at srcKey, append it to dstKey and return its value.
    @Nullable Long
    rPush(byte[] key, byte[]... values)
    Append values to key.
    @Nullable Long
    rPushX(byte[] key, byte[] value)
    Append values to key only if the list exists.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.valkey.springframework.data.valkey.connection.ValkeyListCommands

    lPos
  • Constructor Details

  • Method Details

    • rPush

      public @Nullable Long rPush(byte[] key, byte[]... values)
      Description copied from interface: ValkeyListCommands
      Append values to key.
      Specified by:
      rPush in interface ValkeyListCommands
      Parameters:
      key - must not be null.
      values - must not be empty.
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • lPos

      public @Nullable List<Long> lPos(byte[] key, byte[] element, @Nullable Integer rank, @Nullable Integer count)
      Description copied from interface: ValkeyListCommands
      Returns the index of matching elements inside the list stored at given key.
      Requires Valkey 6.0.6 or newer.
      Specified by:
      lPos in interface ValkeyListCommands
      Parameters:
      key - must not be null.
      element - must not be null.
      rank - specifies the "rank" of the first element to return, in case there are multiple matches. A rank of 1 means to return the first match, 2 to return the second match, and so forth.
      count - number of matches to return.
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • lPush

      public @Nullable Long lPush(byte[] key, byte[]... values)
      Description copied from interface: ValkeyListCommands
      Prepend values to key.
      Specified by:
      lPush in interface ValkeyListCommands
      Parameters:
      key - must not be null.
      values - must not be empty.
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • rPushX

      public @Nullable Long rPushX(byte[] key, byte[] value)
      Description copied from interface: ValkeyListCommands
      Append values to key only if the list exists.
      Specified by:
      rPushX in interface ValkeyListCommands
      Parameters:
      key - must not be null.
      value - must not be null.
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • lPushX

      public @Nullable Long lPushX(byte[] key, byte[] value)
      Description copied from interface: ValkeyListCommands
      Prepend values to key only if the list exists.
      Specified by:
      lPushX in interface ValkeyListCommands
      Parameters:
      key - must not be null.
      value - must not be null.
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • lLen

      public @Nullable Long lLen(byte[] key)
      Description copied from interface: ValkeyListCommands
      Get the size of list stored at key.
      Specified by:
      lLen in interface ValkeyListCommands
      Parameters:
      key - must not be null.
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • lRange

      public @Nullable List<byte[]> lRange(byte[] key, long start, long end)
      Description copied from interface: ValkeyListCommands
      Get elements between start and end from list at key.
      Specified by:
      lRange in interface ValkeyListCommands
      Parameters:
      key - must not be null.
      Returns:
      empty List if key does not exists or range does not contain values. null when used in pipeline / transaction.
      See Also:
    • lTrim

      public void lTrim(byte[] key, long start, long end)
      Description copied from interface: ValkeyListCommands
      Trim list at key to elements between start and end.
      Specified by:
      lTrim in interface ValkeyListCommands
      Parameters:
      key - must not be null.
      See Also:
    • lIndex

      public @org.jspecify.annotations.Nullable byte[] lIndex(byte[] key, long index)
      Description copied from interface: ValkeyListCommands
      Get element at index form list at key.
      Specified by:
      lIndex in interface ValkeyListCommands
      Parameters:
      key - must not be null.
      index - zero based index value. Use negative number to designate elements starting at the tail.
      Returns:
      null when index is out of range or when used in pipeline / transaction.
      See Also:
    • lInsert

      public @Nullable Long lInsert(byte[] key, ValkeyListCommands.Position where, byte[] pivot, byte[] value)
      Description copied from interface: ValkeyListCommands
      Specified by:
      lInsert in interface ValkeyListCommands
      Parameters:
      key - must not be null.
      where - must not be null.
      pivot - must not be null.
      value - must not be null.
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • lMove

      public @org.jspecify.annotations.Nullable byte[] lMove(byte[] sourceKey, byte[] destinationKey, ValkeyListCommands.Direction from, ValkeyListCommands.Direction to)
      Description copied from interface: ValkeyListCommands
      Atomically returns and removes the first/last element (head/tail depending on the from argument) of the list stored at sourceKey, and pushes the element at the first/last element (head/tail depending on the to argument) of the list stored at destinationKey.
      Specified by:
      lMove in interface ValkeyListCommands
      Parameters:
      sourceKey - must not be null.
      destinationKey - must not be null.
      from - must not be null.
      to - must not be null.
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • bLMove

      public @org.jspecify.annotations.Nullable byte[] bLMove(byte[] sourceKey, byte[] destinationKey, ValkeyListCommands.Direction from, ValkeyListCommands.Direction to, double timeout)
      Description copied from interface: ValkeyListCommands
      Atomically returns and removes the first/last element (head/tail depending on the from argument) of the list stored at sourceKey, 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.

      Specified by:
      bLMove in interface ValkeyListCommands
      Parameters:
      sourceKey - must not be null.
      destinationKey - must not be null.
      from - must not be null.
      to - must not be null.
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • lSet

      public void lSet(byte[] key, long index, byte[] value)
      Description copied from interface: ValkeyListCommands
      Set the value list element at index.
      Specified by:
      lSet in interface ValkeyListCommands
      Parameters:
      key - must not be null.
      See Also:
    • lRem

      public @Nullable Long lRem(byte[] key, long count, byte[] value)
      Description copied from interface: ValkeyListCommands
      Removes the first count occurrences of value from the list stored at key.
      Specified by:
      lRem in interface ValkeyListCommands
      Parameters:
      key - must not be null.
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • lPop

      public @org.jspecify.annotations.Nullable byte[] lPop(byte[] key)
      Description copied from interface: ValkeyListCommands
      Removes and returns first element in list stored at key.
      Specified by:
      lPop in interface ValkeyListCommands
      Parameters:
      key - must not be null.
      Returns:
      null when key does not exist or used in pipeline / transaction.
      See Also:
    • lPop

      public @Nullable List<byte[]> lPop(byte[] key, long count)
      Description copied from interface: ValkeyListCommands
      Removes and returns first elements in list stored at key.
      Specified by:
      lPop in interface ValkeyListCommands
      Parameters:
      key - must not be null.
      Returns:
      null when key does not exist or used in pipeline / transaction.
      See Also:
    • rPop

      public @org.jspecify.annotations.Nullable byte[] rPop(byte[] key)
      Description copied from interface: ValkeyListCommands
      Removes and returns last element in list stored at key.
      Specified by:
      rPop in interface ValkeyListCommands
      Parameters:
      key - must not be null.
      Returns:
      null when key does not exist or used in pipeline / transaction.
      See Also:
    • rPop

      public @Nullable List<byte[]> rPop(byte[] key, long count)
      Description copied from interface: ValkeyListCommands
      Removes and returns last elements in list stored at key.
      Specified by:
      rPop in interface ValkeyListCommands
      Parameters:
      key - must not be null.
      Returns:
      null when key does not exist or used in pipeline / transaction.
      See Also:
    • bLPop

      public @Nullable List<byte[]> bLPop(int timeout, byte[]... keys)
      Description copied from interface: ValkeyListCommands
      Removes and returns first element from lists stored at keys.
      Blocks connection until element available or timeout reached.
      Specified by:
      bLPop in interface ValkeyListCommands
      Parameters:
      timeout - seconds to block.
      keys - must not be null.
      Returns:
      empty List when no element could be popped and the timeout was reached. null when used in pipeline / transaction.
      See Also:
    • bRPop

      public @Nullable List<byte[]> bRPop(int timeout, byte[]... keys)
      Description copied from interface: ValkeyListCommands
      Removes and returns last element from lists stored at keys.
      Blocks connection until element available or timeout reached.
      Specified by:
      bRPop in interface ValkeyListCommands
      Parameters:
      timeout - seconds to block.
      keys - must not be null.
      Returns:
      empty List when no element could be popped and the timeout was reached. null when used in pipeline / transaction.
      See Also:
    • rPopLPush

      public @org.jspecify.annotations.Nullable byte[] rPopLPush(byte[] srcKey, byte[] dstKey)
      Description copied from interface: ValkeyListCommands
      Remove the last element from list at srcKey, append it to dstKey and return its value.
      Specified by:
      rPopLPush in interface ValkeyListCommands
      Parameters:
      srcKey - must not be null.
      dstKey - must not be null.
      Returns:
      can be null.
      See Also:
    • bRPopLPush

      public @org.jspecify.annotations.Nullable byte[] bRPopLPush(int timeout, byte[] srcKey, byte[] dstKey)
      Description copied from interface: ValkeyListCommands
      Remove the last element from list at srcKey, append it to dstKey and return its value.
      Blocks connection until element available or timeout reached.
      Specified by:
      bRPopLPush in interface ValkeyListCommands
      Parameters:
      timeout - seconds to block.
      srcKey - must not be null.
      dstKey - must not be null.
      Returns:
      can be null.
      See Also: