LPUSH

Since 1.1.0Lists

Syntax

LPUSH key value [value ...]
  • Flags: fast, write
  • ACL categories: @fast, @list, @write
  • Arity: -3

Adds values to the head (left) of the list at key, one after another, so the last value given ends up first. A missing key is created.

Reply

  • The length of the list afterwards.
  • A WRONGTYPE error if the key is not a list.

Examples

> RPUSH l a b c
(integer) 3
> LPUSH l z
(integer) 4
> LRANGE l 0 -1
1) "z"
2) "a"
3) "b"
4) "c"