RPOPLPUSH
Deprecated: use LMOVE instead.
RPOPLPUSH source destination
- Group
- List
- Complexity
- O(1)
- Arity
- 3 (exactly, counting the command name)
- Flags
- write
- Keys
- first 1, last 2, step 1
- HotKV Cloud
- All plans
- On-Premise
- no license needed
RPOPLPUSH removes the last element of the list at source and pushes it to
the head of the list at destination, atomically. It is the same as
LMOVE source destination RIGHT LEFT; new code should use
LMOVE.
destination is created if needed, and source is deleted when its last
element leaves. Using the same key for both rotates the list, moving the last
element to the front.
Return value
Section titled “Return value”| Case | RESP2 | RESP3 |
|---|---|---|
| Moved | Bulk string: the element that was moved | Same |
source does not exist |
Nil bulk string | Null |
RPOPLPUSH replies with a WRONGTYPE error if source is not a list, or if
destination exists and is not a list. Nothing is moved in that case.
Examples
Section titled “Examples”127.0.0.1:6379> RPUSH src a b c(integer) 3127.0.0.1:6379> RPOPLPUSH src dst"c"127.0.0.1:6379> LRANGE dst 0 -11) "c"Compatibility
Section titled “Compatibility”Same as Redis 7.4 and Valkey 8, where it is also deprecated in favour of
LMOVE.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.