method
RedisClient.brpoplpush
timeout: number
): Promise<null | string>;
Blocking right pop from source and left push to destination
Atomically pops an element from the tail of source list and pushes it to the head of destination list, blocking until an element is available or the timeout expires. This is the blocking version of RPOPLPUSH.
@param source
Source list key
@param destination
Destination list key
@param timeout
Timeout in seconds (can be fractional, 0 = block indefinitely)
@returns
Promise that resolves with the moved element or null on timeout
// Block for up to 1 second
const element = await redis.brpoplpush("tasks", "processing", 1.0);
if (element) {
console.log(`Processing task: ${element}`);
} else {
console.log("No tasks available");
}
// Block indefinitely (timeout = 0)
const task = await redis.brpoplpush("queue", "active", 0);Referenced types
type KeyLike = string | ArrayBufferView | Blob