CF.INSERTNX
Syntax
CF.INSERTNX key [CAPACITY capacity] [NOCREATE] ITEMS item [item ...]
Time complexity: O(k * n), where k is the number of sub-filters and n is the number of items
ACL categories: @cuckoo
Adds one or more items to the Cuckoo filter at key, creating it first if it doesn't exist.
Unlike CF.INSERT, an item is only added if it doesn't already exist in the filter.
Parameters
| Parameter | Default | Description |
|---|---|---|
key | The name of the filter. | |
CAPACITY | 1024 | Initial capacity to use if the filter is created by this command. Ignored if key already exists. |
NOCREATE | If set, the filter must already exist; otherwise an error is returned instead of creating it. | |
ITEMS | One or more items to add. Required. |
Return
Array reply of Integer replies, one per item, in the same order as the input:
1if the item was successfully added.0if the item already exists in the filter.-1if the filter is full and the item could not be added.
Error reply: if NOCREATE is set and key does not exist, or CAPACITY is 0.
Examples
dragonfly> CF.INSERTNX cf ITEMS Hello World
1) (integer) 1
2) (integer) 1
dragonfly> CF.INSERTNX cf ITEMS Hello Again
1) (integer) 0
2) (integer) 1
dragonfly> CF.INSERTNX no_such_key NOCREATE ITEMS bar
(error) no such key