Redis Lists: LPUSH
LPUSH key value1 [value2]
Redis LPUSH command is used to insert all the specified values at the head of the list stored at key. It is created as an empty list before performing the push operations if tje key does not exist. When key holds a value that is not a list, an error is returned.
Syntax:
LPUSH KEY_NAME VALUE1.. VALUEN
Available since
1.0.0.
Return Value
Integer replies the length of the list after the push operations.
Return Value Type
Integer
Example: Redis LPUSH
127.0.0.1:6379> LPUSH mycolor1 white black (integer) 2 127.0.0.1:6379> LRANGE mycolor1 0 -1 1) "black" 2) "white" 127.0.0.1:6379> LPUSH mycolor1 red blue (integer) 4 127.0.0.1:6379> LRANGE mycolor1 0 -1 1) "blue" 2) "red" 3) "black" 4) "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