Easy Tutorial
❮ Sets Sismember Strings Getbit ❯

Redis Brpop Command

Redis Lists

The Redis Brpop command removes and retrieves the last 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 Brpop command 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 popped within the specified time, it returns a nil and the waiting duration. 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> DEL list1 list2
(integer) 0
redis> RPUSH list1 a b c
(integer) 3
redis> BRPOP list1 list2 0
1) "list1"
2) "c"

Redis Lists

❮ Sets Sismember Strings Getbit ❯