Redis Set SINTERSTORE Command
The Redis SINTERSTORE
command stores the intersection of the specified sets in a given destination set. If the destination set already exists, it will be overwritten.
Syntax
The basic syntax of the SINTERSTORE
command is as follows:
1 | SINTERSTORE destination key [key ...] |
This command is equal to SINTER
, but instead of returning the resulting set, it is stored in destination.
If destination already exists, it is overwritten.
Available Since
Redis version >= 1.0.0
Time Complexity
O(N*M) worst case where N is the cardinality of the smallest set and M is the number of sets.
ACL Categories
@write
, @set
, @slow
Return Value
Returns the number of elements in the set that stores the intersection.
Example
1 | 127.0.0.1:6379> SADD key1 a b c d |
All articles on this blog are licensed under CC BY-NC-SA 4.0 unless otherwise stated.