Redis - List Brpoplpush Command



Redis BRPOPLPUSH command is used to pop a value from a list, push it to another list and return it, or block until one is available. BRPOPLPUSH command just returns the last element and inserts it into another list, 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 BRPOPLPUSH command.

redis 127.0.0.1:6379> BRPOPLPUSH LIST1 ANOTHER_LIST TIMEOUT 

Example

redis 127.0.0.1:6379> BRPOPLPUSH list1 list2 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 will pop data and push it into another list; otherwise after 100 seconds nil value is returned.

(nil) 
(100.06s) 
redis_lists.htm
Advertisements