summaryrefslogtreecommitdiff
path: root/redis
diff options
context:
space:
mode:
authordvora-h <67596500+dvora-h@users.noreply.github.com>2022-02-02 13:52:34 +0200
committerGitHub <noreply@github.com>2022-02-02 13:52:34 +0200
commitb541da6b00c00f038293b596a62b5ecb6fdbbaa4 (patch)
treed96061015d37c5ecddaf806cb54384120fb58e98 /redis
parent7ea1bf7593f72b5e23f7e4efc7890faec8a3dde5 (diff)
downloadredis-py-b541da6b00c00f038293b596a62b5ecb6fdbbaa4.tar.gz
Add support for SINTERCARD (#1859)
* add sintercard * fix pr comment
Diffstat (limited to 'redis')
-rw-r--r--redis/commands/core.py13
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