Skip to content

Commit 8750730

Browse files
authored
Add RESP2/3 return information to the Cuckoo filter commands (#1720)
1 parent 4ccfbf9 commit 8750730

File tree

12 files changed

+222
-82
lines changed

12 files changed

+222
-82
lines changed

content/commands/cf.add.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,6 @@ If `key` does not exist - a new cuckoo filter is created.
5050
is an item to add.
5151
</details>
5252

53-
## Return value
54-
55-
Returns one of these replies:
56-
57-
- [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) - where "1" means that the item has been added successfully
58-
- [] on error (invalid arguments, wrong key type, etc.) and also when the filter is full
59-
6053
## Complexity
6154

6255
O(n + i), where n is the number of `sub-filters` and i is `maxIterations`.
@@ -72,3 +65,21 @@ redis> CF.ADD cf item1
7265
redis> CF.ADD cf item1
7366
(integer) 1
7467
{{< / highlight >}}
68+
69+
## Return information
70+
71+
{{< multitabs id="cf-add-return-info"
72+
tab1="RESP2"
73+
tab2="RESP3" >}}
74+
75+
One of the following:
76+
* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): `1` for successfully adding an item to the filter.
77+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, or when the filter is full.
78+
79+
-tab-sep-
80+
81+
One of the following:
82+
* [Boolean reply]({{< relref "/develop/reference/protocol-spec#booleans" >}}): `true` for successfully adding an item to the filter.
83+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, or when the filter is full.
84+
85+
{{< /multitabs >}}

content/commands/cf.addnx.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,6 @@ If `key` does not exist - a new cuckoo filter is created.
5656
is an item to add.
5757
</details>
5858

59-
## Return value
60-
61-
Returns one of these replies:
62-
63-
- [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), where `0` means that the item's fingerprint already exist in the filter, and `1` means that the item has been successfully added to the filter.
64-
- [] on error (invalid arguments, wrong key type, etc.) and also when the filter is full.
65-
6659
## Examples
6760

6861
{{< highlight bash >}}
@@ -71,3 +64,21 @@ redis> CF.ADDNX cf item
7164
redis> CF.ADDNX cf item
7265
(integer) 0
7366
{{< / highlight >}}
67+
68+
## Return information
69+
70+
{{< multitabs id="cf-addnx-return-info"
71+
tab1="RESP2"
72+
tab2="RESP3" >}}
73+
74+
One of the following:
75+
* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): `1` for successfully adding an item to the filter or `0` if the item's fingerprint already exists in the filter.
76+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, or when the filter is full.
77+
78+
-tab-sep-
79+
80+
One of the following:
81+
* [Boolean reply]({{< relref "/develop/reference/protocol-spec#booleans" >}}): `true` for successfully adding an item to the filter or `false` if the item's fingerprint already exists in the filter.
82+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, or when the filter is full.
83+
84+
{{< /multitabs >}}

content/commands/cf.count.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,6 @@ is key name for a cuckoo filter.
4848
is an item to check.
4949
</details>
5050

51-
## Return value
52-
53-
Returns one of these replies:
54-
55-
- [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), where a positive value is an estimation of the number of times `item` was added to the filter. An overestimation is possible, but not an underestimation. `0` means that `key` does not exist or that `item` had not been added to the filter. See note in [`CF.DEL`]({{< relref "commands/cf.del/" >}}).
56-
- [] on error (invalid arguments, wrong key type, etc.)
57-
5851
## Examples
5952

6053
{{< highlight bash >}}
@@ -67,3 +60,21 @@ redis> CF.COUNT cf item1
6760
redis> CF.COUNT cf item2
6861
(integer) 2
6962
{{< / highlight >}}
63+
64+
## Return information
65+
66+
{{< multitabs id=“cf-count-return-info"
67+
tab1="RESP2"
68+
tab2="RESP3" >}}
69+
70+
One of the following:
71+
* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), where a positive value is an estimation of the number of times `item` was added to the filter. An overestimation is possible, but not an underestimation. `0` means that `key` does not exist or that `item` had not been added to the filter. See the note in [`CF.DEL`]({{< relref "commands/cf.del/" >}}).
72+
* [Simple error]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments or wrong key type.
73+
74+
-tab-sep-
75+
76+
One of the following:
77+
* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), where a positive value is an estimation of the number of times `item` was added to the filter. An overestimation is possible, but not an underestimation. `0` means that `key` does not exist or that `item` had not been added to the filter. See the note in [`CF.DEL`]({{< relref "commands/cf.del/" >}}).
78+
* [Simple error]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments or wrong key type.
79+
80+
{{< /multitabs >}}

content/commands/cf.del.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,6 @@ is an item to delete.
5757
O(n), where n is the number of `sub-filters`. Both alternative locations are
5858
checked on all `sub-filters`.
5959

60-
## Return value
61-
62-
Returns one of these replies:
63-
64-
- [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) - where "1" means that the item has been deleted, and "0" means that such item was not found in the filter
65-
- [] on error (invalid arguments, wrong key type, etc.)
66-
6760
## Examples
6861

6962
{{< highlight bash >}}
@@ -82,3 +75,21 @@ redis> CF.DEL cf item2
8275
redis> CF.DEL cf item2
8376
(integer) 0
8477
{{< / highlight >}}
78+
79+
## Return information
80+
81+
{{< multitabs id=“cf-del-return-info"
82+
tab1="RESP2"
83+
tab2="RESP3" >}}
84+
85+
One of the following:
86+
* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) `1` for successfully deleting an item, or `0` if no such item was found in the filter.
87+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments or wrong key type.
88+
89+
-tab-sep-
90+
91+
One of the following:
92+
* [Boolean reply]({{< relref "/develop/reference/protocol-spec#booleans" >}}) `true` for successfully deleting an item, or `false` if no such item was found in the filter.
93+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments or wrong key type.
94+
95+
{{< /multitabs >}}

content/commands/cf.exists.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,6 @@ is key name for a cuckoo filter.
4848
is an item to check.
4949
</details>
5050

51-
## Return value
52-
53-
Returns one of these replies:
54-
55-
- [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), where `1` means that, with high probability, `item` had already been added to the filter, and `0` means that `key` does not exist or that `item` had not been added to the filter. See note in [`CF.DEL`]({{< relref "commands/cf.del/" >}}).
56-
- [] on error (invalid arguments, wrong key type, and so on)
57-
5851
## Examples
5952

6053
{{< highlight bash >}}
@@ -65,3 +58,19 @@ redis> CF.EXISTS cf item1
6558
redis> CF.EXISTS cf item2
6659
(integer) 0
6760
{{< / highlight >}}
61+
62+
{{< multitabs id="cf-exists-return-info"
63+
tab1="RESP2"
64+
tab2="RESP3" >}}
65+
66+
One of the following:
67+
* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): `1` means that, with high probability, `item` was already added to the filter, and `0` means that either the `key` does not exist or that the `item` had not been added to the filter.
68+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) if invalid arguments are passed.
69+
70+
-tab-sep-
71+
72+
One of the following:
73+
* [Boolean reply]({{< relref "/develop/reference/protocol-spec#booleans" >}}): `true` means that, with high probability, `item` was already added to the filter, and `false` means that either `key` does not exist or that `item` had not been added to the filter.
74+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) if invalid arguments are passed or `key` is not of the correct type.
75+
76+
{{< /multitabs >}}

content/commands/cf.info.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,6 @@ Returns information about a cuckoo filter.
3838
is key name for a cuckoo filter.
3939
</details>
4040

41-
## Return value
42-
43-
Returns one of these replies:
44-
45-
- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) with argument name ([Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}})) and value ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}})) pairs
46-
- [] on error (invalid arguments, key does not exist, wrong key type, and so on)
47-
4841
## Examples
4942

5043
{{< highlight bash >}}
@@ -66,3 +59,21 @@ redis> CF.INFO cf
6659
15) Max iteration
6760
16) (integer) 20
6861
{{< / highlight >}}
62+
63+
## Return information
64+
65+
One of the following:
66+
67+
{{< multitabs id=“cf-info-return-info"
68+
tab1="RESP2"
69+
tab2="RESP3" >}}
70+
71+
* [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) with argument name ([Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}})) and value ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}})) pairs.
72+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) if invalid arguments are passed, `key` does not exist, or `key` is not of the correct type.
73+
74+
-tab-sep-
75+
76+
* [Map reply]({{< relref "/develop/reference/protocol-spec#maps" >}}) with argument name ([Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}})) and value ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}})) pairs.
77+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) if invalid arguments are passed, `key` does not exist, or `key` is not of the correct type.
78+
79+
{{< /multitabs >}}

content/commands/cf.insert.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,6 @@ If specified, prevents automatic filter creation if the filter does not exist (I
8484
This option is mutually exclusive with `CAPACITY`.
8585
</details>
8686

87-
## Return value
88-
89-
Returns one of these replies:
90-
91-
- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) - where "1" means that the item has been successfully added to the filter, and "-1" means that the item was not added because the filter is full.
92-
- [] on error (invalid arguments, wrong key type, and so on) and also when `NOCREATE` is specified and `key` does not exist.
93-
9487
## Examples
9588

9689
{{< highlight bash >}}
@@ -113,3 +106,21 @@ redis> CF.INSERT cf2 ITEMS 1 1 1 1
113106
3) (integer) -1
114107
4) (integer) -1
115108
{{< / highlight >}}
109+
110+
## Return information
111+
112+
{{< multitabs id=“cf-insert-return-info"
113+
tab1="RESP2"
114+
tab2="RESP3" >}}
115+
116+
One of the following:
117+
118+
* [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}), where each element is an [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) of `1` for successfully adding an item, or `-1` when the item cannot be added because the filter is full.
119+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors">}}) when the number of arguments or key type is incorrect, and also when `NOCREATE` is specified and `key` does not exist.
120+
121+
-tab-sep-
122+
123+
* [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}), where each element is a [boolean reply]({{< relref "/develop/reference/protocol-spec#booleans" >}}) of `1` for successfully adding an item, or `-1` when the item cannot be added because the filter is full.
124+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors">}}) when the number of arguments or key type is incorrect, and also when `NOCREATE` is specified and `key` does not exist.
125+
126+
{{< /multitabs >}}

content/commands/cf.insertnx.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,6 @@ If specified, prevents automatic filter creation if the filter does not exist (I
9191
This option is mutually exclusive with `CAPACITY`.
9292
</details>
9393

94-
## Return value
95-
96-
Returns one of these replies:
97-
98-
- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), where `0` means that the item's fingerprint already exists in the filter, `1` means that the item has been successfully added to the filter, and `-1` means that the item was not added because the filter is full.
99-
- [] on error (invalid arguments, wrong key type, etc.) and also when `NOCREATE` is specified and `key` does not exist.
100-
10194
### Complexity
10295

10396
O(n + i), where n is the number of `sub-filters` and i is `maxIterations`.
@@ -123,3 +116,21 @@ redis> CF.INSERTNX cf CAPACITY 1000 ITEMS item1 item2 item3
123116
redis> CF.INSERTNX cf_new CAPACITY 1000 NOCREATE ITEMS item1 item2
124117
(error) ERR not found
125118
{{< / highlight >}}
119+
120+
## Return information
121+
122+
{{< multitabs id=“cf-insert-return-info"
123+
tab1="RESP2"
124+
tab2="RESP3" >}}
125+
126+
One of the following:
127+
128+
* [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}), where each element is an [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) of `0` means that the item's fingerprint already exists in the filter, `1` for successfully adding an item, or `-1` when the item cannot be added because the filter is full.
129+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors">}}) when the number of arguments or key type is incorrect, and also when `NOCREATE` is specified and `key` does not exist.
130+
131+
-tab-sep-
132+
133+
* [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}), where each element is a [boolean reply]({{< relref "/develop/reference/protocol-spec#booleans" >}}) of `1` for successfully adding an item, or `-1` when the item cannot be added because the filter is full.
134+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors">}}) when the number of arguments or key type is incorrect, and also when `NOCREATE` is specified and `key` does not exist.
135+
136+
{{< /multitabs >}}

content/commands/cf.loadchunk.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,21 @@ Returns one of these replies:
7171
## Examples
7272

7373
See [`CF.SCANDUMP`]({{< relref "commands/cf.scandump/" >}}) for an example.
74+
75+
## Return information
76+
77+
{{< multitabs id="bf-loadchunk-return-info"
78+
tab1="RESP2"
79+
tab2="RESP3" >}}
80+
81+
One of the following:
82+
* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}): `OK` if executed correctly.
83+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, or when invalid data was passed.
84+
85+
-tab-sep-
86+
87+
One of the following:
88+
* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}): `OK` if executed correctly.
89+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, or when invalid data was passed.
90+
91+
{{< /multitabs >}}

content/commands/cf.mexists.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,6 @@ is key name for a cuckoo filter.
5050
One or more items to check.
5151
</details>
5252

53-
## Return value
54-
55-
Returns one of these replies:
56-
57-
- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) - where "1" means that, with high probability, `item` was already added to the filter, and "0" means that `key` does not exist or that `item` had not added to the filter. See note in [`CF.DEL`]({{< relref "commands/cf.del/" >}}).
58-
- [] on error (invalid arguments, wrong key type, etc.)
59-
6053
## Examples
6154

6255
{{< highlight bash >}}
@@ -68,3 +61,21 @@ redis> CF.MEXISTS cf item1 item2 item3
6861
2) (integer) 1
6962
3) (integer) 0
7063
{{< / highlight >}}
64+
65+
## Return information
66+
67+
{{< multitabs id="bf-mexists-return-info"
68+
tab1="RESP2"
69+
tab2="RESP3" >}}
70+
71+
One of the following:
72+
* [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [integer replies]({{< relref "/develop/reference/protocol-spec#integers" >}}), where `1` means that, with high probability, `item` was already added to the filter, and `0` means that `key` does not exist or that `item` was definitely not added to the filter. See note in [`CF.DEL`]({{< relref "commands/cf.del/" >}}).
73+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: in these cases: invalid arguments, wrong key type, or when the key was not found.
74+
75+
-tab-sep-
76+
77+
One of the following:
78+
* [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [boolean replies]({{< relref "/develop/reference/protocol-spec#booleans" >}}), where `true` means that, with high probability, `item` was already added to the filter, and `false` means that `key` does not exist or that `item` was definitely not added to the filter.
79+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: in these cases: invalid arguments, wrong key type, or when the key was not found.
80+
81+
{{< /multitabs >}}

content/commands/cf.reserve.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,6 @@ When a new filter is created, its size is the size of the current filter multipl
107107
Expansion is rounded to the next `2^n` number.
108108
</details>
109109

110-
## Return value
111-
112-
Returns one of these replies:
113-
114-
- [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) - `OK` if filter created successfully
115-
- [] on error (invalid arguments, key already exists, etc.)
116-
117110
## Examples
118111

119112
{{< highlight bash >}}
@@ -126,3 +119,21 @@ redis> CF.RESERVE cf 1000
126119
redis> CF.RESERVE cf_params 1000 BUCKETSIZE 8 MAXITERATIONS 20 EXPANSION 2
127120
OK
128121
{{< / highlight >}}
122+
123+
## Return information
124+
125+
{{< multitabs id="cf-reserve-return-info"
126+
tab1="RESP2"
127+
tab2="RESP3" >}}
128+
129+
One of the following:
130+
* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}): `OK` if the filter was created successfully.
131+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments or the key already exists.
132+
133+
-tab-sep-
134+
135+
One of the following:
136+
* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}): `OK` if the filter was created successfully.
137+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments or the key already exists.
138+
139+
{{< /multitabs >}}

0 commit comments

Comments
 (0)