English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Redis Lpushx Command

Redis Lists (List)

Redis Lpushx inserts a value at the beginning of an existing list. The operation is invalid if the list does not exist.

Syntax

Basic Syntax of redis Lpushx Command

redis 127.0.0.1:6379> LPUSHX KEY_NAME VALUE1.. VALUEN

Available Version

>= 2.2.0

Return Value

The length of the list after LPUSHX command execution.

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