YouTip LogoYouTip

Lists Lpushx

Redis Lpushx Command | Rookie Tutorial

Redis Lpushx Command | Rookie Tutorial

Rookie Tutorial -- Learning not only technology, but also dreams!

Redis Tutorial

Redis TutorialRedis IntroductionRedis InstallationRedis ConfigurationRedis Data Types

Redis Commands

Redis CommandsRedis KeysRedis StringsRedis HashesRedis ListsRedis SetsRedis Sorted SetsRedis HyperLogLogRedis Pub/SubRedis TransactionsRedis ScriptingRedis ConnectionRedis ServerRedis GEORedis Stream

Redis Advanced Tutorial

Redis Backup and RecoveryRedis SecurityRedis BenchmarkingRedis Client ConnectionRedis PipeliningRedis PartitioningJava using RedisPHP using Redis

Redis Hashes

Redis Sets

Deep Exploration

Scripting Languages

Programming

Scripting

Data Management

Computer Science

Network Services

Software

Web Service

Search

Programming Languages

Redis Lpushx Command

Image 3 Redis Lists

Redis Lpushx inserts a value into the head of an existing list. The operation is invalid 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.

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"

Image 4 Redis Lists

← Lists LrangeLists Lpush β†’