diff options
Diffstat (limited to 'redis/commands')
-rw-r--r-- | redis/commands/bf/__init__.py | 1 | ||||
-rw-r--r-- | redis/commands/bf/commands.py | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/redis/commands/bf/__init__.py b/redis/commands/bf/__init__.py index a448def..4da060e 100644 --- a/redis/commands/bf/__init__.py +++ b/redis/commands/bf/__init__.py @@ -198,6 +198,7 @@ class BFBloom(BFCommands, AbstractBloom): # BF_MEXISTS: spaceHolder, # BF_SCANDUMP: spaceHolder, # BF_LOADCHUNK: spaceHolder, + # BF_CARD: spaceHolder, BF_INFO: BFInfo, } diff --git a/redis/commands/bf/commands.py b/redis/commands/bf/commands.py index f6bf281..c45523c 100644 --- a/redis/commands/bf/commands.py +++ b/redis/commands/bf/commands.py @@ -11,6 +11,7 @@ BF_MEXISTS = "BF.MEXISTS" BF_SCANDUMP = "BF.SCANDUMP" BF_LOADCHUNK = "BF.LOADCHUNK" BF_INFO = "BF.INFO" +BF_CARD = "BF.CARD" CF_RESERVE = "CF.RESERVE" CF_ADD = "CF.ADD" @@ -165,6 +166,14 @@ class BFCommands: """ # noqa return self.execute_command(BF_INFO, key) + def card(self, key): + """ + Returns the cardinality of a Bloom filter - number of items that were added to a Bloom filter and detected as unique + (items that caused at least one bit to be set in at least one sub-filter). + For more information see `BF.CARD <https://redis.io/commands/bf.card>`_. + """ # noqa + return self.execute_command(BF_CARD, key) + class CFCommands: """Cuckoo Filter commands.""" |