Mrpoplpush
Bun

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

This is equivalent to LMOVE with "RIGHT" "LEFT". It's an atomic operation that removes the last element (tail) from the source list and pushes it to the head of the destination list.

@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