Sunday, 12 April 2015

BRPOP key1, key2 ...keyN timeout

Syntax
BRPOP key1, key2 ...keyN timeout
    It is blocked implementation of RPOP command. It blocks, if there are no elementsfrom any of the lists to pop. It waits for specific timeout and returns nil if no element to pop after timeout.

Returns
    Returns the popped element and the list form which list it poped.
127.0.0.1:6379> flushall 
OK 
127.0.0.1:6379> lpush list1 1 2 3 
(integer) 3 
127.0.0.1:6379> lpush list2 4 5 6 
(integer) 3 
127.0.0.1:6379> lpush list3 7 8 9 
(integer) 3 
127.0.0.1:6379> brpop list1 list2 list3 1000 
1) "list1" 
2) "1" 
127.0.0.1:6379> brpop list1 list2 list3 1000 
1) "list1" 
2) "2" 
127.0.0.1:6379> brpop list1 list2 list3 1000 
1) "list1" 
2) "3" 
127.0.0.1:6379> brpop list1 list2 list3 1000 
1) "list2" 
2) "4" 
127.0.0.1:6379> brpop list1 list2 list3 1000 
1) "list2" 
2) "5" 
127.0.0.1:6379> brpop list1 list2 list3 1000 
1) "list2" 
2) "6" 
127.0.0.1:6379> brpop list1 list2 list3 1000 
1) "list3" 
2) "7" 
127.0.0.1:6379> brpop list1 list2 list3 1000 
1) "list3" 
2) "8" 
127.0.0.1:6379> brpop list1 list2 list3 1000 
1) "list3" 
2) "9" 

 
Prevoius                                                 Next                                                 Home

No comments:

Post a Comment