Latest web development tutorials

Redis Brpop command

Redis list (List)

Redis Brpop command and get out of the last element of the list, if the list is not a list of the elements will be blocked until a timeout or a date can be found in the pop-up element.

grammar

redis Blpop basic command syntax is as follows:

redis 127.0.0.1:6379> BRPOP LIST1 LIST2 .. LISTN TIMEOUT 

Available versions

> = 2.0.0

return value

If no element is ejected, it returns nil and a long waiting time within a specified time. On the other hand, returns a list containing two elements, the first element is a key element belongs is ejected, the second element is the value of the element to be ejected.

Examples

redis 127.0.0.1:6379> BRPOP list1 100

In the example above, the operation will be blocked, if the first element of the list specified key list1 presence data is returned, otherwise waits for 100 seconds will return nil.

(nil)
(100.06s)

Redis list (List)