Arguments
str
required
The key of the set to store the resulting set in.
*List[str]
required
The keys of the sets to perform the difference operation on.
Response
The number of elements in the resulting set.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
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"}
Write the difference between sets to a new 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"}
Was this page helpful?