BZMPOP
BZMPOP timeout numkeys key [key ...] <MIN | MAX> [COUNT count]
bzmpop(
timeout: float,
numkeys: int,
keys: List[str],
min: Optional[bool] = False,
max: Optional[bool] = False,
count: Optional[int] = 1
) → Optional[list]
- Available since:
- Redis Open Source 7.0.0
- Time complexity:
- O(K) + O(M*log(N)) where K is the number of provided keys, N being the number of elements in the sorted set, and M being the number of elements popped.
- ACL categories:
-
@write,@sortedset,@slow,@blocking, - Compatibility:
- Redis Software and Redis Cloud compatibility
BZMPOP is the blocking variant of ZMPOP.
When any of the sorted sets contains elements, this command behaves exactly like ZMPOP.
When used inside a MULTI/EXEC block or a Lua script, this command behaves exactly like ZMPOP.
When all sorted sets are empty, Redis will block the connection until another client adds members to one of the keys or until the timeout (a double value specifying the maximum number of seconds to block) elapses.
A timeout of zero can be used to block indefinitely.
See ZMPOP for more information.
Required arguments
timeout
The maximum time to block, in seconds. A timeout of 0 blocks indefinitely.
numkeys
The number of keys that follow.
key [key ...]
One or more sorted-set keys to pop from.
MIN | MAX
Pop the members with the lowest scores (MIN) or the highest scores (MAX).
Optional arguments
COUNT count
The number of members to pop. Defaults to 1.
Redis Software and Redis Cloud compatibility
| Redis Software |
Redis Cloud |
Notes |
|---|---|---|
| ✅ Standard |
✅ Standard |
Return information
One of the following:
- Nil reply: when no element could be popped.
- Array reply: a two-element array with the first element being the name of the key from which elements were popped, and the second element is an array of the popped elements. Every entry in the elements array is also an array that contains the member and its score.
One of the following:
- Null reply: when no element could be popped.
- Array reply: a two-element array with the first element being the name of the key from which elements were popped, and the second element is an array of the popped elements. Every entry in the elements array is also an array that contains the member and its score.