method
RedisClient.lmove
from: 'LEFT' | 'RIGHT',
to: 'LEFT' | 'RIGHT'
): Promise<null | string>;
Atomically pop an element from a source list and push it to a destination list
Pops an element from the source list (from LEFT or RIGHT) and pushes it to the destination list (to LEFT or RIGHT).
@param source
The source list key
@param destination
The destination list key
@param from
Direction to pop from source: "LEFT" (head) or "RIGHT" (tail)
@param to
Direction to push to destination: "LEFT" (head) or "RIGHT" (tail)
@returns
Promise that resolves with the element moved, or null if the source list is empty
await redis.lpush("source", "a", "b", "c");
const result1 = await redis.lmove("source", "dest", "LEFT", "RIGHT");
// result1: "c" (popped from head of source, pushed to tail of dest)
const result2 = await redis.lmove("source", "dest", "RIGHT", "LEFT");
// result2: "a" (popped from tail of source, pushed to head of dest)Referenced types
type KeyLike = string | ArrayBufferView | Blob