Redis Brpoplpush command
Redis Brpoplpush command value from a pop-up list, pop elements into another list and return it; if there is no element of the list will block until a timeout or until the list can be found in the pop-up element.
grammar
redis Brpoplpush basic command syntax is as follows:
redis 127.0.0.1:6379> BRPOPLPUSH LIST1 ANOTHER_LIST TIMEOUT
Available versions
> = 2.0.0
return value
If no element is ejected, it returns nil and a long waiting time within a specified time. On the other hand, returns a list containing two elements, the first element is the pop-up value of the element, the second element is to wait long.
Examples
# 非空列表 redis> BRPOPLPUSH msg reciver 500 "hello moto" # 弹出元素的值 (3.38s) # 等待时长 redis> LLEN reciver (integer) 1 redis> LRANGE reciver 0 0 1) "hello moto" # 空列表 redis> BRPOPLPUSH msg reciver 1 (nil) (1.34s)