content/commands/cf.add.md
Adds an item to the cuckoo filter.
Cuckoo filters can contain the same item multiple times, and consider each addition as separate.
Use [CF.ADDNX]({{< relref "commands/cf.addnx/" >}}) to add an item only if it does not exist.
is key name for a cuckoo filter to add the item to.
If key does not exist - a new cuckoo filter is created.
is an item to add.
</details>O(n + i), where n is the number of sub-filters and i is maxIterations.
Adding items requires up to 2 memory accesses per sub-filter.
But as the filter fills up, both locations for an item might be full.
The filter attempts to Cuckoo swap items up to maxIterations times.
{{< highlight bash >}} redis> CF.ADD cf item1 (integer) 1 redis> CF.ADD cf item1 (integer) 1 {{< / highlight >}}
| Redis Software | Redis Cloud | <span style="min-width: 9em; display: table-cell">Notes</span> | |:----------------------|:-----------------|:------| | <span title="Supported">✅ Supported</span> | <span title="Supported"><nobr>✅ Flexible & Annual</nobr></span> <span title="Supported">✅ Free & Fixed</nobr></span> | |
{{< multitabs id="cf-add-return-info" tab1="RESP2" tab2="RESP3" >}}
One of the following:
1 for successfully adding an item to the filter.-tab-sep-
One of the following:
true for successfully adding an item to the filter.{{< /multitabs >}}