Pop one or more elements from one or more lists
Pops elements from the first non-empty list in the specified order (LEFT = from head, RIGHT = from tail). Optionally specify COUNT to pop multiple elements at once.
method
Pop one or more elements from one or more lists
Pops elements from the first non-empty list in the specified order (LEFT = from head, RIGHT = from tail). Optionally specify COUNT to pop multiple elements at once.
The number of keys that follow
Keys followed by LEFT or RIGHT, optionally followed by "COUNT" and count value
Promise that resolves with [key, [elements]] or null if all lists are empty
await redis.lpush("list1", "a", "b", "c");
const result1 = await redis.lmpop(1, "list1", "LEFT");
// result1: ["list1", ["c"]]
const result2 = await redis.lmpop(1, "list1", "RIGHT", "COUNT", 2);
// result2: ["list1", ["a", "b"]]
const result3 = await redis.lmpop(2, "emptylist", "list1", "LEFT");
// result3: null (if both lists are empty)