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 from the list, if the list has no elements, it will block the list until the timeout or an element to pop is found.

Syntax

Basic Syntax of Redis Blpop Command

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

Available Version

>= 2.0.0

Return Value

If the list is empty, return a 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 example, the operation will be blocked, if the specified list key list1 If there is data, the first element will be returned, otherwise wait10Will return nil after 0 seconds.

(nil)
(100.06s)

Redis Lists (List)