BF.CARD
Syntax
BF.CARD key
- Available in:
- Redis Stack / Bloom 2.4.4
- Time complexity:
- O(1)
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)
(since RedisBloom 2.4.4)
Required arguments
key
is key name for a Bloom filter.
Return value
Returns one of these replies:
- Integer reply - the number of items that were added to this Bloom filter and detected as unique (items that caused at least one bit to be set in at least one sub-filter), or 0 when
key
does not exist. - [] on error (invalid arguments, wrong key type, etc.)
Note: when key
exists - return the same value as BF.INFO key ITEMS
.
Examples
redis> BF.ADD bf1 item_foo
(integer) 1
redis> BF.CARD bf1
(integer) 1
redis> BF.CARD bf_new
(integer) 0