Redis Sunionstore Command
The Redis Sunionstore command stores the union of the given sets in the specified set destination. If destination already exists, it will be overwritten.
Syntax
The basic syntax of the redis Sunionstore command is as follows:
SUNIONSTORE destination key [key ...]
Available Versions
>= 1.0.0
Return Value
The number of elements in the resulting set.
Examples
redis> SADD key1 "a" (integer) 1 redis> SADD key1 "b" (integer) 1 redis> SADD key1 "c" (integer) 1 redis> SADD key2 "c" (integer) 1 redis> SADD key2 "d" (integer) 1 redis> SADD key2 "e" (integer) 1 redis> SUNIONSTORE key key1 key2 (integer) 5 redis> SMEMBERS key 1) "c" 2) "b" 3) "e" 4) "d" 5) "a" redis>
Other Extensions
Redis Set