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

Redis Lpop Command

Redis Lpop Command

Redis List

The Redis Lpop command is used to remove and return the first element of the list.

Syntax

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



redis 127.0.0.1:6379> Lpop KEY_NAME 

Available Version

= 1.0.0

Return Value

The first element of the list. Returns nil when the list key does not exist.

Example



redis 127.0.0.1:6379> RPUSH list1 "foo"

(integer) 1

redis 127.0.0.1:6379> RPUSH list1 "bar"

(integer) 2

redis 127.0.0.1:6379> LPOP list1

"foo"

Redis List