Redis Lpush Command
--
- Home
- HTML
- JavaScript
- CSS
- Vue
- React
- Python3
- Java
- C
- C++
- C#
- AI
- Go
- SQL
- Linux
- VS Code
- Bootstrap
- Git
- Local Bookmark
Redis Tutorial
Redis Tutorial
Redis Introduction
Redis Installation
Redis Configuration
Redis Data Types
Redis Commands
Redis Commands
Redis Keys
Redis Strings
Redis Hashes
Redis Lists
Redis Sets
Redis Sorted Sets
Redis HyperLogLog
Redis Pub/Sub
Redis Transactions
Redis Scripting
Redis Connection
Redis Server
Redis GEO
Redis Stream
Redis Advanced Tutorial
Redis Backup and Recovery
Redis Security
Redis Performance Testing
Redis Client Connection
Redis Pipelining
Redis Partitioning
Java Using Redis
PHP Using Redis
Redis Hashes
Redis Sets
Redis Lpush Command
Redis Lists
The Redis LPUSH command inserts one or more values at the head of the list. If the key does not exist, an empty list is created before performing the LPUSH operation. When the key exists but is not of list type, an error is returned.
Note: Before Redis version 2.4, the LPUSH command only accepted a single value.
Syntax
The basic syntax of the redis LPUSH command is as follows:
redis 127.0.0.1:6379> LPUSH KEY_NAME VALUE1.. VALUEN
Available Version
>= 1.0.0
Return Value
The length of the list after executing the LPUSH command.
Example
127.0.0.1:6379> LPUSH list1 "foo" (integer) 1 127.0.0.1:6379> LPUSH list1 "bar" (integer) 2 127.0.0.1:6379> LRANGE list1 0 -1 1) "bar" 2) "foo"
ByteArk Coding Plan supports mainstream large models such as Doubao, GLM, DeepSeek, Kimi, MiniMax, etc., directly provided by the official for stable and reliable service. Configuration Guide οΏ₯9.9/month Subscribe Now
YouTip