redis BRPOP command


  Translation results:

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: popped

redis BRPOP commandsyntax

Function: BRPOP is the blocking pop-up primitive of the list.

Syntax: BRPOP key [key ...] timeout

Description: It is the blocking version of the RPOP command. When the given list is When there are no elements to pop up, the connection will be blocked by the BRPOP command until the wait times out or a pop-up element is found. When multiple key parameters are given, each list is checked in order of parameter key and the tail element of the first non-empty list pops up. For more information about blocking operations, please view the BLPOP command. BRPOP behaves the same as BLPOP except for the position of the pop-up element.

Available versions: >= 2.0.0

Time complexity: O(1)

Return: If no element is popped out within the specified time, return a nil and the waiting time. Otherwise, a list containing two elements is returned. The first element is the key to which the popped element belongs, and the second element is the value of the popped element.

redis BRPOP commandexample

redis> LLEN course
(integer) 0
redis> RPUSH course algorithm001
(integer) 1
redis> RPUSH course c++101
(integer) 2
redis> BRPOP course 30
1) "course"             # 弹出元素的 key
2) "c++101"             # 弹出元素的值

Home

Videos

Q&A