- Redis Basics
- Redis - Home
- Redis - Overview
- Redis - Environment
- Redis - Configuration
- Redis - Data types
- Redis Commands
- Redis - Commands
- Redis - Keys
- Redis - Strings
- Redis - Hashes
- Redis - Lists
- Redis - Sets
- Redis - Sorted Sets
- Redis - HyperLogLog
- Redis - Publish Subscribe
- Redis - Transactions
- Redis - Scripting
- Redis - Connections
- Redis - Server
- Redis Advanced
- Redis - Backup
- Redis - Security
- Redis - Benchmarks
- Redis - Client Connection
- Redis - Pipelining
- Redis - Partitioning
- Redis - Java
- Redis - Php
- Redis Useful Resources
- Redis - Quick Guide
- Redis - Useful Resources
- Redis - Discussion
Redis - Set Sunionstore Command
Redis SUNIONSTORE command is used to store the members of the set resulting from the union of all the given sets. Keys that do not exist are considered to be empty sets.
Return Value
Integer reply, the number of elements in the resulting set.
Syntax
Following is the basic syntax of Redis SUNIONSTORE command.
redis 127.0.0.1:6379> SUNIONSTORE DESTINATION KEY KEY1..KEYN
Example
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"
redis_sets.htm
Advertisements
To Continue Learning Please Login
Login with Google