Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

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"

Previous: LPOP
Next: LPUSHX