|
RpoplpushCommand
We moved to Redis.io!Redis home moved to http://redis.io, please visit our new home. |
► Sign in to add a comment
|
Search
|
|
RpoplpushCommand
We moved to Redis.io!Redis home moved to http://redis.io, please visit our new home. |
RPOPLPUSH is a bulk command:
RPOPLPUSH src 5 target
RPOPLPUSH returns a bulk reply that indicates the affected element in the source list
LPUSH k1 1 k +OK RPOPLPUSH k1 2 k2 $1 k
sorry there is a bug in this command, Redis is expecting a bulk last argument while it's totally not needed. I'll fix this in Redis 1.2.1 synching with client libs authors.
great idea, but I think it's the wrong direction for queues. Queues are FiFo? (first in, first out). We fill the queue with RPUSH(key,value) Docs: "Append an element to the tail of the List value at key" So we need LPOP to get the oldest message. Please give us LPOPRPUSH or everybody has to implement the queues in revers logic! Or am I totally wrong?
Can anyone give an example of using RPOPLPUSH to traverse a list?
I was thinking that I could refactor this method: http://github.com/defunkt/resque/blob/master/lib/resque/job.rb#L78 to use RPOPLPUSH instead of LRANGE and LREM.
RPOPLPUSH can be used to traverse a list by making srckey and destkey the same. This just rotates the list, except in redis-1.2.6 it just pops elements and empties the list for some reason, works perfectly fine in 2.0.0 however.