Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

redisRPopLPush

Remove the tail from a list, pushing to another.


Description

Atomically return and remove the last (tail) element of the src list, and push the element as the first (head) element of the dst list.

Usage

redisRPopLPush(src, dest, ...)

Arguments

src

A key corresponding to the source list.

dest

A key corresponding to the destination list.

...

Optional additional arguments. Specify raw=TRUE to skip de-serialization of the data.

Details

Atomically return and remove the last (tail) element of the src list, and push the element as the first (head) element of the dst list. For example if the source list contains the elements "a","b","c" and the destination list contains the elements "foo","bar" after a redisRPopLPush command the content of the two lists will be "a","b" and "c","foo","bar".

If the key does not exist or the list is already empty the special value NULL is returned. If the srckey and dstkey are the same the operation is equivalent to removing the last element from the list and pusing it as first element of the list, so it's a "list rotation" command.

See the Redis reference below for programming examples and discussion.

Value

The value moved or rotated across lists, or NULL if the source key does not exist or corresponds to an empty list. An error is thrown if either of the keys does not correspond to a value of 'list' type.

Author(s)

B. W. Lewis

References

http://redis.io/commands

See Also

Examples

## Not run: 
redisConnect()
redisLPush('x',1)
redisLPush('x',2)
redisLPush('x',3)
redisRPopLPush('x','x')
redisRPopLPush('x','x')

## End(Not run)

rredis

"Redis" Key/Value Database Client

v1.7.0
Apache License (>= 2.0)
Authors
B. W. Lewis
Initial release
2015-07-04

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.