lpushx
LPUSHX
Apply for Redis Developer Course
|
Redis Regular Inspection / Technical Support
|
Redis Enterprise Server
|
|---|
Push data to the left of the list only if the key already exists
Usage is lpushx key value.
Example
| Command> | lpush mylist Hello |
| Result> | 1 |
| Command> | lpushx mylist Redis |
| Result> | 2 |
| Command> | lpushx mylist2 World Cannot insert into a key that does not exist. Returns 0. |
| Result> | 0 |
| Command> | exists mylist2 |
| Result> | 0 |
Syntax
LPUSHX key value
- Available since version 2.2.0.
- Time complexity is O(1).
| Related commands | RPUSHX, LPUSH, RPUSH |
| Clients for Java | Jedis, Lettuce, Redisson | Clients for C | Hiredis |
| << RPOPLPUSH | LPUSHX | RPUSHX >> |
|---|
Email
답글이 올라오면 이메일로 알려드리겠습니다.
