count
英[ka?nt] 美[ka?nt]
n.Total number; Count; Count; Arguments
v. Count ;Calculate the total; count...;Important
Third person singular: counts Plural: counts Present participle: counting Past tense: counted Past participle: counted
redis ZCOUNT command syntax
Function:Returns the number of members in the ordered set key whose score value is between min and max (the default includes score value equal to min or max).
Syntax: ZCOUNT key min max
Available versions:>= 2.0.0
Time complexity Degree: O(log(N) M), N is the cardinality of the ordered set, M is the number of elements with values ??between min and max.
Return: The number of members whose score value is between min and max.
redis ZCOUNT command example
redis> ZRANGE salary 0 -1 WITHSCORES # 測試數(shù)據(jù) 1) "jack" 2) "2000" 3) "peter" 4) "3500" 5) "tom" 6) "5000" redis> ZCOUNT salary 2000 5000 # 計(jì)算薪水在 2000-5000 之間的人數(shù) (integer) 3 redis> ZCOUNT salary 3000 5000 # 計(jì)算薪水在 3000-5000 之間的人數(shù) (integer) 2