SUNIONSTORE command in redis

SUNIONSTORE dstkey key1 key2 ... keyN

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

Note: Any existing value in the dstkey will be over-written.

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

RETURN VALUE: Status code reply

Syntax:

SUNIONSTORE dstkey key1 key2 ... keyN

Example

redis:6379> SADD myrediKey hello redis tutorial
(integer) 3
redis:6379> SADD myredisKey2 hello java
(integer) 2
redis:6379> SUNIONSTORE dstKey myrediKey myredisKey2
(integer) 4

Output

4

No comments:

Post a Comment