From b8491ebe22c055fba09171a3b0ab26563cd8e0f6 Mon Sep 17 00:00:00 2001 From: Kostas Kyrimis Date: Fri, 26 Jun 2026 17:05:09 +0300 Subject: [PATCH] chore: cf.reserve docs Signed-off-by: Kostas Kyrimis --- docs/command-reference/compatibility.md | 17 +++---- .../cuckoo-filter/_category_.yml | 4 ++ .../cuckoo-filter/cf.reserve.md | 51 +++++++++++++++++++ 3 files changed, 63 insertions(+), 9 deletions(-) create mode 100644 docs/command-reference/cuckoo-filter/_category_.yml create mode 100644 docs/command-reference/cuckoo-filter/cf.reserve.md diff --git a/docs/command-reference/compatibility.md b/docs/command-reference/compatibility.md index 18786351..3b836a4a 100644 --- a/docs/command-reference/compatibility.md +++ b/docs/command-reference/compatibility.md @@ -315,7 +315,6 @@ sidebar_position: 0 | | BF.INFO | Unsupported | | | BF.CARD | Unsupported | | | BF.DEBUG | Unsupported | -| Cuckoo Filter | TBD | Unsupported | | Count-Min Sketch | CMS.INCRBY | Fully supported | | | CMS.INFO | Fully supported | | | CMS.INITBYDIM | Fully supported | @@ -371,17 +370,17 @@ sidebar_position: 0 | | TOPK.COUNT | Fully supported | | | TOPK.LIST | Fully supported | | | TOPK.INFO | Fully supported | -| CF | CF.ADD | Unsupported | -| | CF.ADDNX | Unsupported | -| | CF.COUNT | Unsupported | -| | CF.DEL | Unsupported | -| | CF.EXISTS | Unsupported | -| | CF.INFO | Unsupported | +| Cuckoo Filter | CF.ADD | Fully supported | +| | CF.ADDNX | Fully supported | +| | CF.COUNT | Fully supported | +| | CF.DEL | Fully supported | +| | CF.EXISTS | Fully supported | +| | CF.INFO | Fully supported | | | CF.INSERT | Unsupported | | | CF.INSERTNX | Unsupported | | | CF.LOADCHUNK | Unsupported | -| | CF.MEXISTS | Unsupported | -| | CF.RESERVE | Unsupported | +| | CF.MEXISTS | Fully supported | +| | CF.RESERVE | Fully supported | | | CF.SCANDUMP | Unsupported | | Cluster | ASKING | Unsupported | | | CLUSTER ADDSLOTS | Unsupported | diff --git a/docs/command-reference/cuckoo-filter/_category_.yml b/docs/command-reference/cuckoo-filter/_category_.yml new file mode 100644 index 00000000..6a138f18 --- /dev/null +++ b/docs/command-reference/cuckoo-filter/_category_.yml @@ -0,0 +1,4 @@ +position: 1 +label: Cuckoo Filter +link: + type: generated-index diff --git a/docs/command-reference/cuckoo-filter/cf.reserve.md b/docs/command-reference/cuckoo-filter/cf.reserve.md new file mode 100644 index 00000000..d0466c16 --- /dev/null +++ b/docs/command-reference/cuckoo-filter/cf.reserve.md @@ -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 + + + +## 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 +``` +