What's new in Valkey 9.0? Discover new features and improvements. Read the announcement.

BF.CARD

Returns the cardinality of a bloom filter

Usage
BF.CARD key
Complexity
O(1)
Module
valkey-bloom
Since module version
1.0.0
ACL Categories
@read, @fast, @bloom

Returns the cardinality of a bloom filter which is the number of items that have been successfully added to it.

Examples

127.0.0.1:6379> BF.ADD key val
(integer) 1
127.0.0.1:6379> BF.CARD key
(integer) 1
127.0.0.1:6379> BF.CARD nonexistentkey
(integer) 0

Replies

RESP2

Integer reply: The number of items successfully added to the bloom filter, or 0 if the key does not exist

RESP3

Integer reply: The number of items successfully added to the bloom filter, or 0 if the key does not exist