Mblmove
Bun

method

RedisClient.blmove

source: KeyLike,
destination: KeyLike,
from: 'LEFT' | 'RIGHT',
to: 'LEFT' | 'RIGHT',
timeout: number
): Promise<null | string>;

Blocking move from one list to another

Atomically moves an element from source to destination list, blocking until an element is available or the timeout expires. Allows specifying which end to pop from (LEFT/RIGHT) and which end to push to (LEFT/RIGHT).

@param source

Source list key

@param destination

Destination list key

@param from

Direction to pop from source: "LEFT" or "RIGHT"

@param to

Direction to push to destination: "LEFT" or "RIGHT"

@param timeout

Timeout in seconds (can be fractional, 0 = block indefinitely)

@returns

Promise that resolves with the moved element or null on timeout

// Move from right of source to left of destination (like BRPOPLPUSH)
const element = await redis.blmove("mylist", "otherlist", "RIGHT", "LEFT", 1.0);
if (element) {
  console.log(`Moved element: ${element}`);
}

// Move from left to left
await redis.blmove("list1", "list2", "LEFT", "LEFT", 0.5);

Referenced types

type KeyLike = string | ArrayBufferView | Blob