Redis - List Lpop Command


Advertisements

Redis LPOP command removes and returns the first element of the list stored at the key.

Return Value

String reply, the value of the first element, or nil when the key does not exist.

Syntax

Following is the basic syntax of Redis LPOP command.

redis 127.0.0.1:6379> LPOP KEY_NAME

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.htm
Advertisements