org.springframework.data.redis.connection
Interface RedisListCommands

All Known Subinterfaces:
RedisCommands, RedisConnection, StringRedisConnection
All Known Implementing Classes:
DefaultStringRedisConnection, JedisConnection, JredisConnection, LettuceConnection, SrpConnection

public interface RedisListCommands

List-specific commands supported by Redis.


Nested Class Summary
static class RedisListCommands.Position
          List insertion position.
 
Method Summary
 List<byte[]> bLPop(int timeout, byte[]... keys)
          Removes and returns first element from lists stored at keys (see: lPop(byte[])).
 List<byte[]> bRPop(int timeout, byte[]... keys)
          Removes and returns last element from lists stored at keys (see: rPop(byte[])).
 byte[] bRPopLPush(int timeout, byte[] srcKey, byte[] dstKey)
          Remove the last element from list at srcKey, append it to dstKey and return its value (see rPopLPush(byte[], byte[])).
 byte[] lIndex(byte[] key, long index)
          Get element at index form list at key.
 Long lInsert(byte[] key, RedisListCommands.Position where, byte[] pivot, byte[] value)
          Insert value RedisListCommands.Position.BEFORE or RedisListCommands.Position.AFTER existing pivot for key.
 Long lLen(byte[] key)
          Get the size of list stored at key.
 byte[] lPop(byte[] key)
          Removes and returns first element in list stored at key.
 Long lPush(byte[] key, byte[]... value)
          Prepend values to key.
 Long lPushX(byte[] key, byte[] value)
          Prepend values to key only if the list exits.
 List<byte[]> lRange(byte[] key, long begin, long end)
          Get elements between begin and end from list at key.
 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 begin, long end)
          Trim list at key to elements between begin and end.
 byte[] rPop(byte[] key)
          Removes and returns last element in list stored at key.
 byte[] rPopLPush(byte[] srcKey, byte[] dstKey)
          Remove the last element from list at srcKey, append it to dstKey and return its value.
 Long rPush(byte[] key, byte[]... values)
          Append values to key.
 Long rPushX(byte[] key, byte[] value)
          Append values to key only if the list exists.
 

Method Detail

rPush

Long rPush(byte[] key,
           byte[]... values)
Append values to key.

Parameters:
key -
values -
Returns:
See Also:
http://redis.io/commands/rpush

lPush

Long lPush(byte[] key,
           byte[]... value)
Prepend values to key.

Parameters:
key -
value -
Returns:
See Also:
http://redis.io/commands/lpush

rPushX

Long rPushX(byte[] key,
            byte[] value)
Append values to key only if the list exists.

Parameters:
key -
values -
Returns:
See Also:
http://redis.io/commands/rpushx

lPushX

Long lPushX(byte[] key,
            byte[] value)
Prepend values to key only if the list exits.

Parameters:
key -
value -
Returns:
See Also:
http://redis.io/commands/lpushx

lLen

Long lLen(byte[] key)
Get the size of list stored at key.

Parameters:
key -
Returns:
See Also:
http://redis.io/commands/llen

lRange

List<byte[]> lRange(byte[] key,
                    long begin,
                    long end)
Get elements between begin and end from list at key.

Parameters:
key -
begin -
end -
Returns:
See Also:
http://redis.io/commands/lrange

lTrim

void lTrim(byte[] key,
           long begin,
           long end)
Trim list at key to elements between begin and end.

Parameters:
key -
begin -
end -
See Also:
http://redis.io/commands/ltrim

lIndex

byte[] lIndex(byte[] key,
              long index)
Get element at index form list at key.

Parameters:
key -
index -
Returns:
See Also:
http://redis.io/commands/lindex

lInsert

Long lInsert(byte[] key,
             RedisListCommands.Position where,
             byte[] pivot,
             byte[] value)
Insert value RedisListCommands.Position.BEFORE or RedisListCommands.Position.AFTER existing pivot for key.

Parameters:
key -
where -
pivot -
value -
Returns:
See Also:
http://redis.io/commands/linsert

lSet

void lSet(byte[] key,
          long index,
          byte[] value)
Set the value list element at index.

Parameters:
key -
index -
value -
See Also:
http://redis.io/commands/lset

lRem

Long lRem(byte[] key,
          long count,
          byte[] value)
Removes the first count occurrences of value from the list stored at key.

Parameters:
key -
count -
value -
Returns:
See Also:
http://redis.io/commands/lrem

lPop

byte[] lPop(byte[] key)
Removes and returns first element in list stored at key.

Parameters:
key -
Returns:
See Also:
http://redis.io/commands/lpop

rPop

byte[] rPop(byte[] key)
Removes and returns last element in list stored at key.

Parameters:
key -
Returns:
See Also:
http://redis.io/commands/rpop

bLPop

List<byte[]> bLPop(int timeout,
                   byte[]... keys)
Removes and returns first element from lists stored at keys (see: lPop(byte[])).
Blocks connection until element available or timeout reached.

Parameters:
timeout -
keys -
Returns:
See Also:
http://redis.io/commands/blpop

bRPop

List<byte[]> bRPop(int timeout,
                   byte[]... keys)
Removes and returns last element from lists stored at keys (see: rPop(byte[])).
Blocks connection until element available or timeout reached.

Parameters:
timeout -
keys -
Returns:
See Also:
http://redis.io/commands/brpop

rPopLPush

byte[] rPopLPush(byte[] srcKey,
                 byte[] dstKey)
Remove the last element from list at srcKey, append it to dstKey and return its value.

Parameters:
srcKey -
dstKey -
Returns:
See Also:
http://redis.io/commands/rpoplpush

bRPopLPush

byte[] bRPopLPush(int timeout,
                  byte[] srcKey,
                  byte[] dstKey)
Remove the last element from list at srcKey, append it to dstKey and return its value (see rPopLPush(byte[], byte[])).
Blocks connection until element available or timeout reached.

Parameters:
timeout -
srcKey -
dstKey -
Returns:
See Also:
http://redis.io/commands/brpoplpush