YouTip LogoYouTip

Sets Sunionstore

# Redis Sunionstore Command [!(#) Redis Sets](#) The Redis SUNIONSTORE command stores the union of the given sets into the specified destination set. If the 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. ### 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](#)
← Sets SscanSets Sunion β†’