Redis Lpop Command

Redis List

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

Syntax

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

redis 127.0.0.1:6379> Lpop KEY_NAME 

Available versions

>= 1.0.0

Return value

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

Examples

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

Other extensions