{
  "id": "cf.addnx",
  "title": "CF.ADDNX",
  "url": "https://redis.io/docs/latest/commands/cf.addnx/",
  "summary": "Adds an item to a Cuckoo Filter if the item did not exist previously.",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-04-09T10:29:34-04:00",
  "page_type": "content",
  "content_hash": "7622f86f669c025179ff01ed53e989935fe6675fef3d1acb7d13b5a2068ce3f1",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Adds an item to a cuckoo filter if the item does not exist.\n\nThis command is similar to the combination of [`CF.EXISTS`]() and [`CF.ADD`](). It does not add an item into the filter if its fingerprint already exists.\n\n<note><b>Notes:</b>\n\n- This command is slower than [`CF.ADD`]() because it first checks whether the item exists.\n- Since [`CF.EXISTS`]() can result in false positive, `CF.ADDNX` may not add an item because it is supposedly already exist, which may be wrong.\n\n</note>"
    },
    {
      "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 items 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": "examples",
      "title": "Examples",
      "role": "example",
      "text": "redis> CF.ADDNX cf item\n(integer) 1\nredis> CF.ADDNX cf item\n(integer) 0"
    },
    {
      "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\">&#x2705; Flexible & Annual</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](): `1` for successfully adding an item to the filter or `0` if the item's fingerprint already exists in the filter.\n* [Simple error reply]() 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](): `true` for successfully adding an item to the filter or `false` if the item's fingerprint already exists in the filter.\n* [Simple error reply]() in these cases: invalid arguments, wrong key type, or when the filter is full."
    }
  ],
  "examples": []
}
