Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

RPOPLPUSH

Last updated

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.

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.

127.0.0.1:6379> RPUSH src a b c
(integer) 3
127.0.0.1:6379> RPOPLPUSH src dst
"c"
127.0.0.1:6379> LRANGE dst 0 -1
1) "c"

Same as Redis 7.4 and Valkey 8, where it is also deprecated in favour of LMOVE.

LMOVE, BRPOPLPUSH, BLMOVE