Easy Tutorial
❮ Scripting Evalsha Redis Conf ❯

Redis Sunionstore Command

Redis Sets

The Redis Sunionstore command stores the union of the specified sets in the destination set. If the destination already exists, it will be overwritten.

Syntax

The basic syntax for 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.

Example

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>

Redis Sets

❮ Scripting Evalsha Redis Conf ❯