LPOP key

Available since 1.0.0.

Time complexity: O(1)

Removes and returns the first element of the list stored at key.

*Return value

Bulk string reply: the value of the first element, or nil when key does not exist.

*Examples

redis> RPUSH mylist "one"

  1. (integer) 1

redis> RPUSH mylist "two"

  1. (integer) 2

redis> RPUSH mylist "three"

  1. (integer) 3

redis> LPOP mylist

  1. "one"

redis> LRANGE mylist 0 -1

  1. 1) "two"
  2. 2) "three"
redis>