redis.sadd("key1", "a", "b", "c")

redis.sadd("key2", "c", "d", "e")

# Store the result in a new set
assert redis.sdiffstore("res", "key1", "key2") == 2

assert redis.smembers("set") == {"a", "b"}

Arguments

destination
str
required

The key of the set to store the resulting set in.

keys
*List[str]
required

The keys of the sets to perform the difference operation on.

Response

The number of elements in the resulting set.

redis.sadd("key1", "a", "b", "c")

redis.sadd("key2", "c", "d", "e")

# Store the result in a new set
assert redis.sdiffstore("res", "key1", "key2") == 2

assert redis.smembers("set") == {"a", "b"}