Blocking pop from head 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.
method
Blocking pop from head 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.
Keys followed by timeout in seconds (can be fractional, 0 = block indefinitely)
Promise that resolves with [key, element] or null on timeout
// Block for up to 1 second
const result = await redis.blpop("mylist", 1.0);
if (result) {
const [key, element] = result;
console.log(`Popped ${element} from ${key}`);
}
// Block indefinitely (timeout = 0)
const result2 = await redis.blpop("list1", "list2", 0);