Redis - List Brpop Command



Redis BRPOP command is used to remove and get the last element in a list, or block until one is available. BRPOP command just returns the last element, if available, or blocks the client for specific time to execute any command.

Return Value

String reply, the value of element stored at the key or nil.

Syntax

Following is the basic syntax of Redis BRPOP command.

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

Example

redis 127.0.0.1:6379> BRPOP list1 100

The above example will block the client for 100 seconds to execute any command. If any data comes in the specified key list1, then it returns; otherwise after 100 seconds nil value is returned.

(nil) 
(100.06s) 
redis_lists.htm
Advertisements