Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions docs/command-reference/compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,6 @@ sidebar_position: 0
| | <span class="command">BF.INFO</span> | <span class="support unsupported">Unsupported</span> |
| | <span class="command">BF.CARD</span> | <span class="support unsupported">Unsupported</span> |
| | <span class="command">BF.DEBUG</span> | <span class="support unsupported">Unsupported</span> |
| <span class="family">Cuckoo Filter</span> | <span class="command">TBD</span> | <span class="support unsupported">Unsupported</span> |
| <span class="family">Count-Min Sketch</span> | <span class="command">CMS.INCRBY</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">CMS.INFO</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">CMS.INITBYDIM</span> | <span class="support supported">Fully supported</span> |
Expand Down Expand Up @@ -371,17 +370,17 @@ sidebar_position: 0
| | <span class="command">TOPK.COUNT</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">TOPK.LIST</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">TOPK.INFO</span> | <span class="support supported">Fully supported</span> |
| <span class="family">CF</span> | <span class="command">CF.ADD</span> | <span class="support unsupported">Unsupported</span> |
| | <span class="command">CF.ADDNX</span> | <span class="support unsupported">Unsupported</span> |
| | <span class="command">CF.COUNT</span> | <span class="support unsupported">Unsupported</span> |
| | <span class="command">CF.DEL</span> | <span class="support unsupported">Unsupported</span> |
| | <span class="command">CF.EXISTS</span> | <span class="support unsupported">Unsupported</span> |
| | <span class="command">CF.INFO</span> | <span class="support unsupported">Unsupported</span> |
| <span class="family">Cuckoo Filter</span> | <span class="command">CF.ADD</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">CF.ADDNX</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">CF.COUNT</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">CF.DEL</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">CF.EXISTS</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">CF.INFO</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">CF.INSERT</span> | <span class="support unsupported">Unsupported</span> |
| | <span class="command">CF.INSERTNX</span> | <span class="support unsupported">Unsupported</span> |
| | <span class="command">CF.LOADCHUNK</span> | <span class="support unsupported">Unsupported</span> |
| | <span class="command">CF.MEXISTS</span> | <span class="support unsupported">Unsupported</span> |
| | <span class="command">CF.RESERVE</span> | <span class="support unsupported">Unsupported</span> |
| | <span class="command">CF.MEXISTS</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">CF.RESERVE</span> | <span class="support supported">Fully supported</span> |
| | <span class="command">CF.SCANDUMP</span> | <span class="support unsupported">Unsupported</span> |
| <span class="family">Cluster</span> | <span class="command">ASKING</span> | <span class="support unsupported">Unsupported</span> |
| | <span class="command">CLUSTER ADDSLOTS</span> | <span class="support unsupported">Unsupported</span> |
Expand Down
4 changes: 4 additions & 0 deletions docs/command-reference/cuckoo-filter/_category_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
position: 1
label: Cuckoo Filter
link:
type: generated-index
51 changes: 51 additions & 0 deletions docs/command-reference/cuckoo-filter/cf.reserve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
description: Learn how to use the CF.RESERVE command to create a Cuckoo filter in Dragonfly.
---
import PageTitle from '@site/src/components/PageTitle';

# CF.RESERVE

<PageTitle title="Redis CF.RESERVE Command (Documentation) | Dragonfly" />

## Syntax

CF.RESERVE key capacity [BUCKETSIZE bucketsize] [MAXITERATIONS maxiterations] [EXPANSION expansion]

**Time complexity:** O(1)

**ACL categories:** @cuckoo

Creates a new Cuckoo filter at `key` with an initial capacity of at least `capacity` items.
If `key` already exists, an error is returned.

Unlike Bloom filters, Cuckoo filters support deletion of individual items.

## Parameters

| Parameter | Default | Description |
|-----------------|---------|--------------------------------------------------------------------------------------------------------------------|
| `key` | | The name of the filter. |
| `capacity` | | Estimated number of items the filter should hold. Actual capacity is rounded up to the next power of two. |
| `BUCKETSIZE` | `2` | Number of fingerprint slots per bucket. Higher values improve fill rate but increase false positive probability. |
| `MAXITERATIONS` | `20` | Maximum number of cuckoo-displacement attempts before declaring the filter full. Must be between 1 and 65535. |
| `EXPANSION` | `1` | When the filter is full, a new sub-filter of size `capacity * expansion` is created. `0` disables expansion. |

## Return

[Simple string reply](https://valkey.io/topics/protocol/#simple-strings): `OK` if the filter was created successfully.

[Error reply](https://valkey.io/topics/protocol/#simple-errors): if `key` already exists, or a parameter is out of range.

## Examples

```shell
dragonfly> CF.RESERVE cf 1000
OK

dragonfly> CF.RESERVE cf 1000
(error) item exists

dragonfly> CF.RESERVE cf_custom 10000 BUCKETSIZE 4 MAXITERATIONS 50 EXPANSION 2
OK
```

Loading