pop

UK[pɒp] US[pɑ:p]

vi. (unexpectedly, suddenly) appear; appear suddenly; make a popping sound; (suddenly) action

vt. (suddenly) reach out; (suddenly) ask a question; (suddenly take out something prepared); strike

n.pop music ; soda; (especially used as a title) dad; (quickly marked)

adj. pop music; popular style; popular; modern

adv. explosion; bang

abbr.post office protocol

Third person singular: pops Plural: pops Present participle: popping Past tense: popped Past participle: poppe

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. advance; increase; strive for

Third person singular: pushes present participle : pushing past tense: pushed past participle: pushed

redis RPOPLPUSH command syntax

Function:Command RPOPLPUSH performs the following two actions within an atomic time: pop the last element (tail element) in the list source and return it to the client. Insert the element popped up by source into the list destination as the head element of the destination list.

Syntax:RPOPLPUSH source destination

Available versions:>= 1.2.0

Time complexity :O(1)

Returns:The element being popped.

redis RPOPLPUSH command example

# source 和 destination 不同 redis> LRANGE alpha 0 -1 # 查看所有元素 1) "a" 2) "b" 3) "c" 4) "d" redis> RPOPLPUSH alpha reciver # 执行一次 RPOPLPUSH 看看 "d" redis> LRANGE alpha 0 -1 1) "a" 2) "b" 3) "c" redis> LRANGE reciver 0 -1 1) "d" redis> RPOPLPUSH alpha reciver # 再执行一次,证实 RPOP 和 LPUSH 的位置正确 "c" redis> LRANGE alpha 0 -1 1) "a" 2) "b" redis> LRANGE reciver 0 -1 1) "c" 2) "d" # source 和 destination 相同 redis> LRANGE number 0 -1 1) "1" 2) "2" 3) "3" 4) "4" redis> RPOPLPUSH number number "4" redis> LRANGE number 0 -1 # 4 被旋转到了表头 1) "4" 2) "1" 3) "2" 4) "3" redis> RPOPLPUSH number number "3" redis> LRANGE number 0 -1 # 这次是 3 被旋转到了表头 1) "3" 2) "4" 3) "1" 4) "2"