Latest web development tutorials

Redis Lpushx command

Redis list (List)

Redis Lpushx will insert one or more values ​​to the existing list head, does not occur when the list does not exist.

grammar

redis Lpushx basic command syntax is as follows:

redis 127.0.0.1:6379> LPUSHX KEY_NAME VALUE1.. VALUEN

Available versions

> = 2.2.0

return value

After LPUSHX command is executed, the length of the list.

Examples

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 (List)