Skip to main content

SINTERCARD

Syntax​

SINTERCARD key [key...] [LIMIT limit]

Module​

set

Categories​

read set slow

Description​

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​

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)