English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Redis Sunionstore Command

Redis Sets (Set)

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

Syntax

The basic syntax of the redis Sunionstore command is as follows:

SUNIONSTORE destination key [key ...]

Available Version

>= 1.0.0

Return Value

Number of elements in the result set.

Online 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>

Redis Sets (Set)