CF.ADD key item
- Available in:
- Redis Stack / Bloom 1.0.0
- Time complexity:
- O(k + i), where k is the number of sub-filters and i is maxIterations
Adds an item to the cuckoo filter, creating the filter if it does not exist.
Cuckoo filters can contain the same item multiple times, and consider each insert
as separate. You can use
CF.ADDNX to only add the item if it does not
exist yet. Keep in mind that deleting an element inserted using
cause false-negative errors.
- key: The name of the filter
- item: The item to add
O(n + i), where n is the number of
sub-filters and i is
Adding items requires up to 2 memory accesses per
But as the filter fills up, both locations for an item might be full. The filter
Cuckoo swap items up to
Integer reply - "1" if executed correctly, or Error reply otherwise.
redis> CF.ADD cf item (integer) 1