Set

SDIFFSTORE

Write the difference between sets to a new set

Arguments

destinationbodystrrequired

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

keysbody*List[str]required

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

Response

intrequired

The number of elements in the resulting set.

Example
redis.sadd("key1", "a", "b", "c")redis.sadd("key2", "c", "d", "e")# Store the result in a new setassert redis.sdiffstore("res", "key1", "key2") == 2assert redis.smembers("set") == {"a", "b"}
Loading search…