Skip to main content

ZCOUNT

Syntax​

ZCOUNT key min max

Module​

sortedset

Categories​

read slow sortedset

Description​

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​

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)