diff options
author | dvora-h <67596500+dvora-h@users.noreply.github.com> | 2022-02-02 13:52:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-02 13:52:34 +0200 |
commit | b541da6b00c00f038293b596a62b5ecb6fdbbaa4 (patch) | |
tree | d96061015d37c5ecddaf806cb54384120fb58e98 /redis | |
parent | 7ea1bf7593f72b5e23f7e4efc7890faec8a3dde5 (diff) | |
download | redis-py-b541da6b00c00f038293b596a62b5ecb6fdbbaa4.tar.gz |
Add support for SINTERCARD (#1859)
* add sintercard
* fix pr comment
Diffstat (limited to 'redis')
-rw-r--r-- | redis/commands/core.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/redis/commands/core.py b/redis/commands/core.py index 383c635..5df9345 100644 --- a/redis/commands/core.py +++ b/redis/commands/core.py @@ -2388,6 +2388,19 @@ class SetCommands: args = list_or_args(keys, args) return self.execute_command("SINTER", *args) + def sintercard(self, numkeys: int, keys: List[str], limit: int = 0) -> int: + """ + Return the cardinality of the intersect of multiple sets specified by ``keys`. + + When LIMIT provided (defaults to 0 and means unlimited), if the intersection + cardinality reaches limit partway through the computation, the algorithm will + exit and yield limit as the cardinality + + For more information check https://redis.io/commands/sintercard + """ + args = [numkeys, *keys, "LIMIT", limit] + return self.execute_command("SINTERCARD", *args) + def sinterstore(self, dest, keys, *args): """ Store the intersection of sets specified by ``keys`` into a new |