w3resource

Redis Lists: LPOP

LPOP key

Redis LPOP key is used to remove and returns the first element of the list stored at the key.

Syntax:

LPOP KEY_NAME     

Available since

1.0.0.

Return Value

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

Return Value Type

String

Example: Redis LPOP

127.0.0.1:6379> LPUSH mycolor1 white black red blue
(integer) 4
127.0.0.1:6379> LRANGE mycolor1 0 -1
1) "blue"
2) "red"
3) "black"
4) "white"
127.0.0.1:6379> LPOP mycolor1
"blue"
127.0.0.1:6379> LRANGE mycolor1 0 -1
1) "red"
2) "black"
3) "white"
127.0.0.1:6379> RPOP mycolor1
"white"

Previous: LLEN
Next: LPUSH



Follow us on Facebook and Twitter for latest update.