Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Redis Rpop Command

Redis Rpop Command

Redis List

The Redis Rpop command is used to remove the last element of the list; the return value is 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 Version

= 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 List