Easy Tutorial
❮ Redis Scripting Redis Client Connection ❯

Redis Rpop Command

Redis Lists

The Redis Rpop command is used to remove the last element of a list and returns the removed element.

Syntax

The basic syntax of the redis Rpop command is as follows:

redis 127.0.0.1:6379> RPOP KEY_NAME

Available Versions

= 1.0.0

Return Value

The removed element.

Returns nil when the list does not exist.

Example

redis> RPUSH mylist "one"
(integer) 1
redis> RPUSH mylist "two"
(integer) 2
redis> RPUSH mylist "three"
(integer) 3
redis> RPOP mylist
"three"
redis> LRANGE mylist 0 -1
1) "one"
2) "two"
redis>

Redis Lists

❮ Redis Scripting Redis Client Connection ❯