Blocking pop multiple elements from lists
Blocks until an element is available from one of the specified lists or the timeout expires. Can pop from the LEFT or RIGHT end and optionally pop multiple elements at once using COUNT.
method
Blocking pop multiple elements from lists
Blocks until an element is available from one of the specified lists or the timeout expires. Can pop from the LEFT or RIGHT end and optionally pop multiple elements at once using COUNT.
Timeout in seconds (can be fractional, 0 = block indefinitely)
Number of keys that follow
Keys, direction ("LEFT" or "RIGHT"), and optional COUNT modifier
Promise that resolves with [key, [elements]] or null on timeout
// Pop from left end of first available list, wait 1 second
const result = await redis.blmpop(1.0, 2, "list1", "list2", "LEFT");
if (result) {
const [key, elements] = result;
console.log(`Popped from ${key}: ${elements.join(", ")}`);
}
// Pop 3 elements from right end
const result2 = await redis.blmpop(0.5, 1, "mylist", "RIGHT", "COUNT", 3);
// Returns: ["mylist", ["elem1", "elem2", "elem3"]] or null if timeout