BZPOPMIN(3valkey)

πŸ“¦
version 9.0.6 Β· 2 versions
, in fedora 44

πŸ’… BZPOPMIN β€” the valkey manual page, but make it cute

okay bestie, you're reading the BZPOPMIN page from the Valkey Command Manual (section 3valkey, the command-manual girlies). sit down, grab a strawberry, we're learning about blocking sorted-set pops πŸ’–


✨ NAME ✨

bzpopmin β€” removes and returns the member with the lowest score from one or more sorted sets. blocks until a member is available otherwise. and when it pops the last element out? it deletes the sorted set. gone. periodt. πŸ’€


πŸŽ€ SYNOPSIS πŸŽ€

BZPOPMIN key [key...]  timeout

πŸ¦‹ DESCRIPTION πŸ¦‹

so. BZPOPMIN is literally the blocking variant of the sorted set ZPOPMIN primitive. that's the whole vibe.

it's the blocking version because it blocks the connection when there are no members to pop from any of the given sorted sets 😭 like, it just sits there. waiting. main character energy, honestly. a member with the lowest score gets popped from the first sorted set that is non-empty, and the given keys are checked in the order that they are given β€” so order matters, bestie, don't play.

the timeout argument is interpreted as a double value specifying the maximum number of seconds to block. a timeout of zero can be used to block indefinitely ⏳ (yes, forever. iconic.)

for the exact semantics, go read the BLPOP documentation, because BZPOPMIN is identical to BLPOP β€” the only difference is the data structure being popped from. that's it. that's the tea. 🍡

🌈 REPLY 🌈

RESP2

one of the following, babes:

RESP3

one of the following, same energy:


πŸ”₯ COMPLEXITY πŸ”₯

O(log(N)) where N is the number of elements in the sorted set. fast girl behavior fr fr.


πŸ‘‘ ACL CATEGORIES πŸ‘‘

@blocking @fast @sortedset @write


🌸 HISTORY 🌸

  • Available since: 5.0.0
  • Changed in 6.0.0: timeout is 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> BZPOPMIN zset1 zset2 0
1) "zset1"
2) "a"
3) "0"

look at her go 😭 popped "a" with score "0" from zset1 and didn't even break a sweat.


🫢 SEE ALSO 🫢

bzmpop(3valkey), bzpopmax(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 one's from Valkey version 9.0.0, dated 2025-10-21 β€” go block on a sorted set and slay πŸ’…πŸ’œ

πŸ“¦ where this page comes from