summaryrefslogtreecommitdiffstats
path: root/iredis/data/commands/rpop.md
blob: 6233c0399300249ba57b62dcc44aa9fe7e8b9bae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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.

@history

- `>= 6.2`: Added the `count` argument.

@examples

```cli
RPUSH mylist "one" "two" "three" "four" "five"
RPOP mylist
RPOP mylist 2
LRANGE mylist 0 -1
```