Redis Lists: LPUSHX
LPUSHX key value
Redis LPUSHX command is used to insert value at the head of the list stored at key, only if a key already exists and holds a list.
Syntax:
LPUSHX KEY_NAME VALUE1.. VALUEN
Available since
2.2.0.
Return Value
Integer replies the length of the list after the push operations.
Return Value Type
Integer
Example: Redis LPUSHX
127.0.0.1:6379> LPUSH mycolor1 white (integer) 1 127.0.0.1:6379> LPUSHX mycolor1 black (integer) 2 127.0.0.1:6379> LPUSHX mycolor1 red (integer) 3 127.0.0.1:6379> LPUSHX mycolor2 blue (integer) 0 The key mycolor2 not exists, so return 0 127.0.0.1:6379> EXISTS mycolor2 (integer) 0 127.0.0.1:6379> LRANGE mycolor1 0 -1 1) "red" 2) "black" 3) "white"
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework