SINTER
SINTER key [key ...]
- Group
- Set
- Complexity
- O(N*M) worst case, where N is the size of the smallest set and M is the number of sets
- Arity
- -2 (at least 2 words, counting the command name)
- Flags
- read-only
- Keys
- first 1, last final argument, step 1
- HotKV Cloud
- All plans
- On-Premise
- no license needed
SINTER returns the intersection of the given sets: the members that are in
all of them. A missing key counts as an empty set, so if any key is missing
the result is empty. To count the intersection without returning it, use
SINTERCARD; to store it, use
SINTERSTORE.
Return value
Section titled “Return value”| Case | RESP2 | RESP3 |
|---|---|---|
| Success | Array of bulk strings (empty if there is no common member) | Set of bulk strings |
SINTER replies with a WRONGTYPE error if any of the keys holds a value that
is not a set, even when another key is missing.
Examples
Section titled “Examples”127.0.0.1:6379> SADD a "x" "y" "z"(integer) 3127.0.0.1:6379> SADD b "y" "z" "w"(integer) 3127.0.0.1:6379> SINTER a b1) "y"2) "z"127.0.0.1:6379> SINTER a nosuchkey(empty array)Compatibility
Section titled “Compatibility”Same as Redis 7.4 and Valkey 8.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.