Redis Lpushx Command | Rookie Tutorial
Rookie Tutorial -- Learning not only technology, but also dreams!
- Home
- HTML
- JavaScript
- CSS
- Vue
- React
- Python3
- Java
- C
- C++
- C#
- AI
- Go
- SQL
- Linux
- VS Code
- Bootstrap
- Git
- Local Bookmarks
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
Deep Exploration
Scripting Languages
Programming
Scripting
Data Management
Computer Science
Network Services
Software
Web Service
Search
Programming Languages
Redis Lpushx Command
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"
YouTip