method

RedisClient.rpoplpush

source: KeyLike,
destination: KeyLike
): Promise<null | string>;

Atomically pop the last element from a source list and push it to the head of a destination list

Equivalent to LMOVE with "RIGHT" "LEFT".

@param source

The source list key

@param destination

The destination list key

@returns

Promise that resolves with the element moved, or null if the source list is empty

await redis.lpush("source", "a", "b", "c");
// source: ["c", "b", "a"]

const result = await redis.rpoplpush("source", "dest");
// result: "a" (removed from tail of source, added to head of dest)
// source: ["c", "b"]
// dest: ["a"]

Referenced types

type KeyLike = string | ArrayBufferView | Blob