ZMPOP numkeys key [key ...] <MIN | MAX> [COUNT count]
- Available since:
- 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:
Pops one or more elements, that are member-score pairs, from the first non-empty sorted set in the provided list of key names.
BZMPOP are similar to the following, more limited, commands:
ZPOPMAXwhich take only one key, and can return multiple elements.
BZPOPMAXwhich take multiple keys, but return only one element from just one key.
BZMPOP for the blocking variant of this command.
MIN modifier is used, the elements popped are those with the lowest scores from the first non-empty sorted set. The
MAX modifier causes elements with the highest scores to be popped.
COUNT can be used to specify the number of elements to pop, and is set to 1 by default.
The number of popped elements is the minimum from the sorted set's cardinality and
Array reply: specifically:
nilwhen no element could be popped.
- 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.