Redis Sunionstore command
Redis Sunionstore given command set and stored in the specified collection set in the destination. If the destination already exists, it will be overwritten.
grammar
redis Sunionstore basic command syntax is as follows:
redis 127.0.0.1:6379> SUNIONSTORE DESTINATION KEY KEY1..KEYN
Available versions
> = 1.0.0
return value
The number of elements in the result set.
Examples
redis 127.0.0.1:6379> SADD myset1 "hello" (integer) 1 redis 127.0.0.1:6379> SADD myset1 "world" (integer) 1 redis 127.0.0.1:6379> SADD myset1 "bar" (integer) 1 redis 127.0.0.1:6379> SADD myset2 "hello" (integer) 1 redis 127.0.0.1:6379> SADD myset2 "bar" (integer) 1 redis 127.0.0.1:6379> SUNIONSTORE myset myset1 myset2 (integer) 1 redis 127.0.0.1:6379> SMEMBERS myset 1) "bar" 2) "world" 3) "hello" 4) "foo"