Easy Tutorial
❮ Server Slowlog Pub Sub Publish ❯

Redis BLPOP Command

Redis Lists

The Redis BLPOP command removes and retrieves the first element of a list. If the list is empty, it blocks the list until a timeout occurs or a poppable element is found.

Syntax

The basic syntax for the redis BLPOP command is as follows:

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

Available Versions

= 2.0.0

Return Value

If the list is empty, it returns nil. Otherwise, it returns a list with two elements: the first element is the key of the popped element, and the second element is the value of the popped element.

Example

redis 127.0.0.1:6379> BLPOP list1 100

In the above example, the operation will be blocked. If the specified list key list1 has data, it will return the first element. Otherwise, it will return nil after waiting 100 seconds.

(nil)
(100.06s)

Redis Lists

❮ Server Slowlog Pub Sub Publish ❯