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 LPUSHX command syntax

Function: Insert value value into the header of list key if and only if key exists and is a list. Contrary to the LPUSH command, the LPUSHX command does nothing when the key does not exist.

Syntax: LPUSHX key value

Available versions:>= 2.2.0

Time complexity : O(1)

Return: LPUSHX The length of the table after the command is executed.

redis LPUSHX command example

# 對空列表執(zhí)行 LPUSHX
redis> LLEN greet                       # greet 是一個空列表
(integer) 0
redis> LPUSHX greet "hello"             # 嘗試 LPUSHX,失敗,因?yàn)榱斜頌榭?
(integer) 0
# 對非空列表執(zhí)行 LPUSHX
redis> LPUSH greet "hello"              # 先用 LPUSH 創(chuàng)建一個有一個元素的列表
(integer) 1
redis> LPUSHX greet "good morning"      # 這次 LPUSHX 執(zhí)行成功
(integer) 2
redis> LRANGE greet 0 -1
1) "good morning"
2) "hello"