- Usage:
-
RPOP key [ count ]
- Complexity:
- O(N) where N is the number of elements returned
- Since:
- 1.0.0
-
Nil reply: if the key does not exist.
-
Bulk string reply: when called without the count argument, the value of the last element.
-
Array reply: when called with the count argument, a list of popped elements.
-
Null reply: if the key does not exist.
-
Bulk string reply: when called without the count argument, the value of the last element.
-
Array reply: when called with the count argument, a list of popped elements.
Removes and returns the last elements of the list stored at key
.
By default, the command pops a single element from the end of the list.
When provided with the optional count
argument, the reply will consist of up
to count
elements, depending on the list's length.
Examples
127.0.0.1:6379> RPUSH mylist "one" "two" "three" "four" "five"
(integer) 5
127.0.0.1:6379> RPOP mylist
"five"
127.0.0.1:6379> RPOP mylist 2
1) "four"
2) "three"
127.0.0.1:6379> LRANGE mylist 0 -1
1) "one"
2) "two"
RESP2 Reply
One of the following:
RESP3 Reply
One of the following:
History
Version | Change |
---|---|
6.2.0 | Added the |