blpop key [key ...] timeout
Remove and get the first element in a list, or block until one is available
More:http://redis.io/commands/blpop, http://www.redis.cn/commands/blpop.html
Brpop key [key ...] timeout
Remove and get the last element in a list, or block until one is available
More:http://redis.io/commands/brpop, http://www.redis.cn/commands/brpop.html
Brpoplpush Source Destination Timeout
Pop a value from a list, push it to another list and return it; or block until one is available
More:http://redis.io/commands/brpoplpush, http://www.redis.cn/commands/brpoplpush.html
LINDEX Key Index
Get an element from a list by its index
127.0.0.1:6379> lpush Foo 1 3 5 7 9 (integer) 5127.0.0.1:6379> LINDEX foo 1 "7" 127.0.0.1:6379> LINDEX foo-2 "3"
Linsert Key before| After pivot value
Insert an element before or after another element in a list
127.0.0.1:6379> lpush foo ten (integer) 4127.0.0.1:6379> linsert foo before (integer) 5127.0.0.1:6379> ; Lrange foo 0-11) "2" (3) "4") "5" "Ten" 127.0.0.1:6379> Linsert foo after 0 (integer) 6127.0.0.1:6379> L RANGE foo 0-11) "80" 2) "0" 3) "40" 4) "80" 5) "20" 6) "10"
More:http://redis.io/commands/linsert, http://www.redis.cn/commands/linsert.html
Llen Key
Get the length of a list
127.0.0.1:6379> lpush Foo 1 2 4 (integer) 3127.0.0.1:6379> llen foo (integer) 3
Lpop Key
Remove and get the first element in a list
127.0.0.1:6379> lpush Foo 1 2 4 8 (integer) 4127.0.0.1:6379> lpop foo "8" 127.0.0.1:6379> lpop foo "4"
Lpush key value [value ...]
Prepend one or multiple values to a list
127.0.0.1:6379> lpush foo 1 (integer) 1127.0.0.1:6379> lpush foo 2 4 (integer) 3127.0.0.1:6379> lrange foo-1 0 (EMP Ty list or set) 127.0.0.1:6379> 127.0.0.1:6379> lrange foo 0-11) "4" 2) "2" 3) "1"
Lpushx Key value
Prepend a value to a list, only if the list exists
127.0.0.1:6379> lpushx foo 1 (integer) 0127.0.0.1:6379> lrange foo 0-1 (empty list or set) 127.0.0.1:6379> Lpush fo o 1 (integer) 1127.0.0.1:6379> lpushx foo 2 (integer) 2127.0.0.1:6379> lrange foo 0-11) "2" 2) "1"
Lrange Key Start stop
Get a range of elements from a list
127.0.0.1:6379> lpush Foo 1 3 5 7 9 (integer) 5127.0.0.1:6379> lrange foo 1) "7" 2) "5" 3) "3" 127.0.0.1:6379> LRA NGE foo 0-11) "9" 2) "7" 3) "5" 4) "3" 5) "1"
Lrem Key Count value
Remove elements from a list
127.0.0.1:6379> rpush Foo 1 2 1 3 1 4 (integer) 6127.0.0.1:6379> lrem foo 2 1 (integer) 2127.0.0.1:6379> lrange foo 0-11) "2" 2) "3" 3) "1" 4) "4" 127.0.0.1:6379> rpush foo 3 1 3 2 1 3 (integer) 10127.0.0.1:6379> lrem foo-3 3 (integer) 3127.0.0.1:6379> lrange foo 0-11) "2" 2) "3" 3) "1" 4) "4" 5) "1" 6) "2" 7) "1" 127.0.0.1:6379> lrem foo 0 1 (integer) 312 7.0.0.1:6379> lrange foo 0-11) "2" 2) "3" 3) "4" 4) "2"
More:http://redis.io/commands/lrem, http://www.redis.cn/commands/lrem.html
LSET Key index value
Set the value of an element in a list by its index
127.0.0.1:6379> rpush Foo 1 2 3 4 5 (integer) 5127.0.0.1:6379> LSET foo 3 0ok127.0.0.1:6379> lrange foo 0-11) "1" 2) "2" 3) "3" 4) "0" 5) "5"
LTRIM Key Start stop
Trim a list to the specified range
127.0.0.1:6379> rpush Foo 1 3 5 7 9 (integer) 5127.0.0.1:6379> LTRIM foo 3-1 ok127.0.0.1:6379> lrange foo 0-11) "7" 2) "9"
More:http://redis.io/commands/ltrim, http://www.redis.cn/commands/ltrim.html
Rpop Key
Remove and get the last element in a list
127.0.0.1:6379> rpush Foo 1 2 3 4 (integer) 4127.0.0.1:6379> rpop foo "4" 127.0.0.1:6379> rpop foo "3" 127.0.0.1:6379 > lrange foo 0-11) "1" 2) "2"
Rpoplpush Source Destination
Remove the last element in a list, prepend it to another list and return it
127.0.0.1:6379> rpush Foo 1 3 5 (integer) 3127.0.0.1:6379> rpush bar 2 4 (integer) 2127.0.0.1:6379> rpoplpush foo b Ar "5" 127.0.0.1:6379> lrange foo 0-11) "1" 2) "3" 127.0.0.1:6379> lrange bar 0-11) "5" 2) "2" 3) "4" 127.0.0.1:6379> Rpoplpush Bar Bar "4" 127.0.0.1:6379> lrange bar 0-11) "4" 2 "5" 3) "2"
More:http://redis.io/commands/rpoplpush, http://www.redis.cn/commands/rpoplpush.html
Rpush key value [value ...]
Append one or multiple values to a list
127.0.0.1:6379> rpush foo 1 (integer) 1127.0.0.1:6379> rpush foo 1 2 3 (integer) 4127.0.0.1:6379> lrange foo 0-11) "1" 2) "1" 3 "2" 4) "3"
Rpushx Key value
Append a value to a list, only if the list exists
127.0.0.1:6379> rpushx foo 1 (integer) 0127.0.0.1:6379> lrange foo 0-1 (empty list or set) 127.0.0.1:6379> Rpush fo o 1 (integer) 1127.0.0.1:6379> rpushx foo 2 (integer) 2127.0.0.1:6379> lrange foo 0-11) "1" 2) "2"
Redis (2.8.3) command Learning-Lists