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.
*Return value
When called without the count
argument:
Bulk string reply: the value of the last element, or nil
when key
does not exist.
When called with the count
argument:
Array reply: the values of the last elements, or nil
when key
does not exist.
*History
>= 6.2
: Added thecount
argument.
*Examples
redis>
RPUSH mylist "one"
(integer) 1redis> RPUSH mylist "two"
(integer) 2redis> RPUSH mylist "three"
(integer) 3redis> RPOP mylist
"three"redis> LRANGE mylist 0 -1
1) "one" 2) "two"