Redis Lpushx Command
Redis Lpushx inserts a value at the head of an existing list; the operation has no effect if the list does not exist.
Syntax
The basic syntax of the redis Lpushx command is as follows:
redis 127.0.0.1:6379> LPUSHX KEY_NAME VALUE1.. VALUEN
Available Version
= 2.2.0
Return Value
The length of the list after the LPUSHX command is executed.
Example
127.0.0.1:6379> LPUSH list1 "foo"
(integer) 1
127.0.0.1:6379> LPUSHX list1 "bar"
(integer) 2
127.0.0.1:6379> LPUSHX list2 "bar"
(integer) 0
127.0.0.1:6379> LRANGE list1 0 -1
1) "bar"
2) "foo"
Redis List