BZPOPMAX(3valkey)
π BZPOPMAX π
okay bestie, welcome to the Valkey Command Manual entry for bzpopmax β she's a whole main character and she's about to hand you the highest-scoring member of a sorted set like it's nothing π
β¨ NAME β¨
bzpopmax β removes and returns the member with the highest score from one or more sorted sets. Blocks until a member is available, otherwise. Deletes the sorted set if the last element was popped. π¦
β¨ SYNOPSIS β¨
BZPOPMAX key [key...] timeout
β¨ DESCRIPTION β¨
so BZPOPMAX is literally the blocking variant of the sorted set ZPOPMAX primitive. same energy, just with β¨patienceβ¨
she's the blocking version because she blocks the connection when there are no members to pop from any of the given sorted sets. no cap. a member with the highest score gets popped from the first sorted set that is non-empty, and the keys you gave her are checked in the order that they are given. first come, first served, periodt π
the timeout argument is interpreted as a double value specifying the maximum number of seconds to block. a timeout of 0 can be used to block indefinitely β she will literally wait forever for you, that's devotion π«Ά
π heads up: see theBZPOPMINdocumentation for the exact semantics, becauseBZPOPMAXis identical toBZPOPMINwith the only difference being that it pops members with the highest scores instead of popping the ones with the lowest scores. iykyk.
β¨ REPLY β¨
RESP2
one of the following, bestie:
- valkey-protocol(7) Nil reply: when no element could be popped and the timeout expired. π
- valkey-protocol(7) Array reply: the keyname, popped member, and its score. π
RESP3
one of the following, bestie:
- valkey-protocol(7) Null reply: when no element could be popped and the timeout expired. π
- valkey-protocol(7) Array reply: the keyname, popped member, and its score. π
β¨ COMPLEXITY β¨
O(log(N)) with N being the number of elements in the sorted set. fast girlie behaviour fr fr β
β¨ ACL CATEGORIES β¨
@blocking @fast @sortedset @write
β¨ HISTORY β¨
- Available since:
5.0.0πΈ - Changed in
6.0.0:timeoutis interpreted as a double instead of an integer. glow up β¨
β¨ EXAMPLES β¨
127.0.0.1:6379> DEL zset1 zset2
(integer) 0
127.0.0.1:6379> ZADD zset1 0 a 1 b 2 c
(integer) 3
127.0.0.1:6379> BZPOPMAX zset1 zset2 0
1) "zset1"
2) "c"
3) "2"
look at her go π
"c" with the score 2 β highest score, popped, iconic, no notes π₯
β¨ SEE ALSO β¨
bzmpop(3valkey)bzpopmin(3valkey)zadd(3valkey)zcard(3valkey)zcount(3valkey)zdiff(3valkey)zdiffstore(3valkey)zincrby(3valkey)zinter(3valkey)zintercard(3valkey)zinterstore(3valkey)zlexcount(3valkey)zmpop(3valkey)zmscore(3valkey)zpopmax(3valkey)zpopmin(3valkey)zrandmember(3valkey)zrange(3valkey)zrangebylex(3valkey)zrangebyscore(3valkey)zrangestore(3valkey)zrank(3valkey)zrem(3valkey)zremrangebylex(3valkey)zremrangebyrank(3valkey)zremrangebyscore(3valkey)zrevrange(3valkey)zrevrangebylex(3valkey)zrevrangebyscore(3valkey)zrevrank(3valkey)zscan(3valkey)zscore(3valkey)zunion(3valkey)zunionstore(3valkey)
and that's the whole page, bestie!! π§ this was page BZPOPMAX(3valkey) from the Valkey Command Manual, version 9.0.0, dated 2025-10-21 β go block on something, love u, bye ππ
π¦ where this page comes from
- fedora 44: valkey-doc 9.0.3-2.fc44 Β· CC-BY-SA-4.0
- fedora 44: valkey-doc 9.0.6-1.fc44 Β· CC-BY-SA-4.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms