SDIFFSTORE command in redis

SDIFFSTORE dstkey key1 key2 ... keyN

This command works exactly like SDIFF but instead of being returned the resulting set is stored in dstkey.

TIME COMPLEXITY: O(N) where N is the total number of elements in all the provided sets

RETURN VALUE: Status code reply

Syntax:

SDIFFSTORE dstkey key1 key2 ... keyN

Example

redis:6379> SADD key1 x a b c
(integer) 4
redis:6379> SADD key2 c
(integer) 1
redis:6379> SADD key3 a d
(integer) 2
redis:6379> SDIFFSTORE dstkey key1 key2 key3
(integer) 2

Output

2


No comments:

Post a Comment