{
  "schema_version": 2,
  "id": "commands/cf.add",
  "title": "CF.ADD",
  "url": "https://redis.io/docs/latest/commands/cf.add/",
  "summary": "Adds an item to a Cuckoo Filter",
  "since": "1.0.0",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-09-18T09:48:54+01:00",
  "page_type": "content",
  "content_hash": "1544c91230b34e2d9a5643d1deb82bdc51990023912526db1fe850cfb2e49e7f",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Adds an item to the cuckoo filter.\n\nCuckoo filters can contain the same item multiple times, and consider each addition as separate.\nUse [`CF.ADDNX`](https://redis.io/docs/latest/commands/cf.addnx) to add an item only if it does not exist."
    },
    {
      "id": "required-arguments",
      "title": "Required arguments",
      "role": "content",
      "text": "<details open><summary><code>key</code></summary>\n\nis key name for a cuckoo filter to add the item to.\n\nIf `key` does not exist - a new cuckoo filter is created.\n</details>\n\n<details open><summary><code>item</code></summary>\n\nis an item to add.\n</details>"
    },
    {
      "id": "complexity",
      "title": "Complexity",
      "role": "performance",
      "text": "O(n + i), where n is the number of `sub-filters` and i is `maxIterations`.\nAdding items requires up to 2 memory accesses per `sub-filter`.\nBut as the filter fills up, both locations for an item might be full.\nThe filter attempts to `Cuckoo` swap items up to `maxIterations` times."
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "redis> CF.ADD cf item1\n(integer) 1\nredis> CF.ADD cf item1\n(integer) 1"
    },
    {
      "id": "redis-software-and-redis-cloud-compatibility",
      "title": "Redis Software and Redis Cloud compatibility",
      "role": "content",
      "text": "| Redis<br />Software | Redis<br />Cloud | <span style=\"min-width: 9em; display: table-cell\">Notes</span> |\n|:----------------------|:-----------------|:------|\n| <span title=\"Supported\">&#x2705; Supported</span><br /> | <span title=\"Supported\"><nobr>&#x2705; Flexible & Annual</nobr></span><br /><span title=\"Supported\">&#x2705; Free & Fixed</nobr></span> |  |"
    },
    {
      "id": "return-information",
      "title": "Return information",
      "role": "returns",
      "text": "**RESP2:**\n\nOne of the following:\n* [Integer reply](https://redis.io/docs/latest/develop/reference/protocol-spec#integers): `1` for successfully adding an item to the filter.\n* [Simple error reply](https://redis.io/docs/latest/develop/reference/protocol-spec#simple-errors) in these cases: invalid arguments, wrong key type, or when the filter is full.\n\n**RESP3:**\n\nOne of the following:\n* [Boolean reply](https://redis.io/docs/latest/develop/reference/protocol-spec#booleans): `true` for successfully adding an item to the filter.\n* [Simple error reply](https://redis.io/docs/latest/develop/reference/protocol-spec#simple-errors) in these cases: invalid arguments, wrong key type, or when the filter is full."
    }
  ],
  "examples": []
}
