ZCOUNT
Syntax
ZCOUNT key min max
- Available since:
- 2.0.0
- Time complexity:
- O(log(N)) with N being the number of elements in the sorted set.
- ACL categories:
-
@read
,@sortedset
,@fast
,
返回在key
中分数介于min
和max
之间的有序集合中的元素数量。
min
和 max
参数具有与 ZRANGEBYSCORE
中描述的相同语义。
注意:该命令的复杂度仅为O(log(N)),因为它使用元素排名(参见ZRANK
)来获取范围的概念。因此,不需要做与范围大小成正比的工作。