Mbzpopmax
Bun

method

RedisClient.bzpopmax

...args: number | KeyLike[]
): Promise<null | [string, string, number]>;

Remove and return the member with the highest score from one or more sorted sets, or block until one is available

@param args

Keys followed by timeout in seconds (e.g., "key1", "key2", 1.0)

@returns

Promise that resolves with [key, member, score] or null if timeout

// Block for up to 1 second waiting for an element
const result = await redis.bzpopmax("myzset", 1.0);
if (result) {
  const [key, member, score] = result;
  console.log(`Popped ${member} with score ${score} from ${key}`);
}

Referenced types

type KeyLike = string | ArrayBufferView | Blob