SINTERCARD
Syntax
SINTERCARD key [key...] [LIMIT limit]
Module
setCategories
read set slowDescription
Returns the cardinality of the intersection between multiple sets.
Options
- LIMIT - limit is an integer which determines the cardinality at which the intersection calculation is terminated.
Examples
- Go (Embedded)
- CLI
Get the difference between 2 sets:
db, err := sugardb.NewSugarDB()
if err != nil {
log.Fatal(err)
}
cardinality, err := db.SInterCard([]string{"key1", "key2"}, 0)
Get the intersection only upto an intersection cardinality of 5:
db, err := sugardb.NewSugarDB()
if err != nil {
log.Fatal(err)
}
cardinality, err := db.SInterCard([]string{"key1", "key2"}, 5)
Get the difference between 2 sets:
> SINTERCARD key1 key2
Get the intersection only upto an intersection cardinality of 5:
> SINTERCARD key1 key2 LIMIT 5