ZCOUNT
Syntax
ZCOUNT key min max
Module
sortedsetCategories
read slow sortedsetDescription
Returns the number of elements in the sorted set key with scores in the range of min and max. If the key does not exist, a count of 0 is returned, otherwise return the count. If the key holds a value that is not a sorted set, an error is returned.
Examples
- Go (Embedded)
- CLI
Get the cardinality of the sorted set:
db, err := sugardb.NewSugarDB()
if err != nil {
log.Fatal(err)
}
count, err := db.ZCount("key", 1.25, 10.55)
Get the cardinality of the sorted set:
> ZCOUNT key 1.25 10.55