RPOP key [count]
Available since: 1.0.0
Time complexity: O(N) where N is the number of elements returned
ACL categories:
@write
@list
@fast
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
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: list of popped elements, or nil
when key
does not exist.
@examples
redis> RPUSH mylist "one" "two" "three" "four" "five"
TBD
redis> RPOP mylist
TBD
redis> RPOP mylist 2
TBD
redis> LRANGE mylist 0 -1
History
- Starting with Redis version 6.2.0: Added the
count
argument.