Redis Lpush Command
The Redis Lpush command inserts one or more values at the head of a list. If the key does not exist, an empty list is created and the LPUSH operation is performed. If the key exists but is not a list type, an error is returned.
Note:Before Redis version 2.4, the LPUSH command only accepted a single value.
Syntax
The basic syntax of the Redis Lpush command is as follows:
redis 127.0.0.1:6379> LPUSH KEY_NAME VALUE1.. VALUEN
Available Versions
>= 1.0.0
Return Value
The length of the list after executing the LPUSH command.
Example
127.0.0.1:6379> LPUSH list1 "foo" (integer) 1 127.0.0.1:6379> LPUSH list1 "bar" (integer) 2 127.0.0.1:6379> LRANGE list1 0 -1 1) "bar" 2) "foo"Other Extensions
Redis List