Easy Tutorial
❮ Redis Transactions Sorted Sets Zrank ❯

Redis Lpop Command

Redis Lists

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 Versions

= 1.0.0

Return Value

The first element of the list. If the list key does not exist, it returns nil.

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 Lists

❮ Redis Transactions Sorted Sets Zrank ❯