method
RedisClient.brpop
): Promise<null | [string, string]>;
Blocking pop from tail of one or more lists
Blocks until an element is available in one of the lists or the timeout expires. Checks keys in order and pops from the first non-empty list.
@param args
Keys followed by timeout in seconds (can be fractional, 0 = block indefinitely)
@returns
Promise that resolves with [key, element] or null on timeout
// Block for up to 1 second
const result = await redis.brpop("mylist", 1.0);
if (result) {
const [key, element] = result;
console.log(`Popped ${element} from ${key}`);
}
// Block indefinitely (timeout = 0)
const result2 = await redis.brpop("list1", "list2", 0);Referenced types
type KeyLike = string | ArrayBufferView | Blob