push
UK[pʊʃ] US[pʊʃ]
vt.& vi. Push, push
vt. Press; push, increase; exert pressure on, force; persuade
n. push, determination; large-scale offensive; determined pursuit
vi. push; increase; strive for
Third person singular: pushes Present participle: pushing Past tense: pushed Past participle: pushed
redis LPUSH command syntax
Function:Insert one or more values value into the header of the list key.
Syntax:LPUSH key value [value ...]
Explanation:If there are multiple value values, then each value value is based on Insert into the table header in order from left to right: For example, if you execute the command LPUSH mylist a b c on the empty list mylist, the value of the list will be c b a , which is equivalent to atomically executing LPUSH mylist a , LPUSH mylist b and LPUSH mylist c three commands. If key does not exist, an empty list will be created and the LPUSH operation performed. When key exists but is not a list type, an error is returned. The LPUSH command before Redis 2.4 only accepted a single value value.
Available versions:>= 1.0.0
Time complexity:O(1)
Return:The length of the list after executing the LPUSH command.
redis LPUSH command example
# 加入单个元素 redis> LPUSH languages python (integer) 1 # 加入重复元素 redis> LPUSH languages python (integer) 2 redis> LRANGE languages 0 -1 # 列表允许重复元素 1) "python" 2) "python" # 加入多个元素 redis> LPUSH mylist a b c (integer) 3 redis> LRANGE mylist 0 -1 1) "c" 2) "b" 3) "a"