LPOP

Since 1.1.0Lists

Syntax

LPOP key [count]
  • Flags: fast, write
  • ACL categories: @fast, @list, @write
  • Arity: -2

Removes and returns the first element of the list at key. With count, removes and returns up to that many. A list left empty is deleted.

Reply

  • The element, or nil if the key does not exist.
  • With count: an array of up to count elements, or nil if the key does not exist.

Examples

> RPUSH l a b c
(integer) 3
> LPOP l
"a"
> LPOP l 5
1) "b"
2) "c"
> EXISTS l
(integer) 0