English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Redis Blpop Command

Redis Lists (List)

The Redis Blpop command removes and retrieves the first element of the list, if the list has no elements, it will block the list until the timeout is exceeded or a popable element is found.

Syntax

The basic syntax of the redis Blpop command is as follows:

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

Available Version

>= 2.0.0

Return Value

If the list is empty, return nil. Otherwise, return a list containing two elements, the first element is the key of the popped element, and the second element is the value of the popped element.

Online Examples

redis 127.0.0.1:6379> BLPOP list1 100

In the above examples, operations will be blocked, if the specified list key list1 If there is data, the first element will be returned; otherwise, it will wait.10After 0 seconds, nil will be returned.

(nil)
(100.06s)

Redis Lists (List)