Skip to content

Commit 2859809

Browse files
committed
DEV: add RESP2/3 return information to the CMS commands
1 parent 4bc5ffd commit 2859809

File tree

6 files changed

+120
-33
lines changed

6 files changed

+120
-33
lines changed

content/commands/cms.incrby.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,30 @@ Increases the count of item by increment. Multiple items can be increased with o
4545
* **item**: The item which counter is to be increased.
4646
* **increment**: Amount by which the item counter is to be increased.
4747

48-
## Return
49-
50-
51-
[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) with an updated min-count of each of the items in the sketch.
52-
53-
Count of each item after increment.
54-
5548
## Examples
5649

5750
```
5851
redis> CMS.INCRBY test foo 10 bar 42
5952
1) (integer) 10
6053
2) (integer) 42
6154
```
55+
56+
## Return information
57+
58+
{{< multitabs id=“cms-incrby-return-info"
59+
tab1="RESP2"
60+
tab2="RESP3" >}}
61+
62+
One of the following:
63+
64+
* [Array]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [integer replies]({{< relref "/develop/reference/protocol-spec#integers" >}}) representing updated min-counts of each of the provided items in the sketch.
65+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, missing key, overflow, or wrong key type.
66+
67+
-tab-sep-
68+
69+
One of the following:
70+
71+
* [Array]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [integer replies]({{< relref "/develop/reference/protocol-spec#integers" >}}) representing updated min-counts of each of the provided items in the sketch.
72+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, missing key, overflow, or wrong key type.
73+
74+
{{< /multitabs >}}

content/commands/cms.info.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ Returns width, depth and total count of the sketch.
3535

3636
* **key**: The name of the sketch.
3737

38-
## Return
39-
40-
[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) with information of the filter.
41-
4238
## Examples
4339

4440
```
@@ -50,3 +46,21 @@ redis> CMS.INFO test
5046
5) count
5147
6) (integer) 0
5248
```
49+
50+
{{< multitabs id=“cms-info-return-info"
51+
tab1="RESP2"
52+
tab2="RESP3" >}}
53+
54+
One of the following:
55+
56+
* [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) and [integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) pairs containing sketch information.
57+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, missing key, or wrong key type.
58+
59+
-tab-sep-
60+
61+
One of the following:
62+
63+
* [Map reply]({{< relref "/develop/reference/protocol-spec#maps" >}}) of [simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) and [integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) pairs containing sketch information.
64+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, missing key, or wrong key type.
65+
66+
{{< /multitabs >}}

content/commands/cms.initbydim.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,29 @@ Initializes a Count-Min Sketch to dimensions specified by user.
4242
* **depth**: Number of counter-arrays. Reduces the probability for an
4343
error of a certain size (percentage of total count).
4444

45-
## Return
46-
47-
[Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) - `OK` if executed correctly, or [] otherwise.
48-
4945
## Examples
5046

5147
```
5248
redis> CMS.INITBYDIM test 2000 5
5349
OK
54-
```
50+
```
51+
52+
## Return information
53+
54+
{{< multitabs id=“cms-initbydim-return-info"
55+
tab1="RESP2"
56+
tab2="RESP3" >}}
57+
58+
One of the following:
59+
60+
* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) `OK` if executed correctly.
61+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) if the given key already exists.
62+
63+
-tab-sep-
64+
65+
One of the following:
66+
67+
* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) `OK` if executed correctly.
68+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) if the given key already exists.
69+
70+
{{< /multitabs >}}

content/commands/cms.initbyprob.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,31 @@ Initializes a Count-Min Sketch to accommodate requested tolerances.
4444
be a decimal value between 0 and 1. This effects the depth of the sketch.
4545
For example, for a desired false positive rate of 0.1% (1 in 1000),
4646
error_rate should be set to 0.001. The closer this number is to zero, the
47-
greater the memory consumption per item and the more CPU usage per operation.
48-
49-
## Return
50-
51-
[Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) - `OK` if executed correctly, or [] otherwise.
47+
greater the memory consumption per item and the more CPU usage per operation.
5248

5349
## Examples
5450

5551
```
5652
redis> CMS.INITBYPROB test 0.001 0.01
5753
OK
58-
```
54+
```
55+
56+
## Return information
57+
58+
{{< multitabs id=“cms-initbyprob-return-info"
59+
tab1="RESP2"
60+
tab2="RESP3" >}}
61+
62+
One of the following:
63+
64+
* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) `OK` if executed correctly.
65+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) if the given key already exists.
66+
67+
-tab-sep-
68+
69+
One of the following:
70+
71+
* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) `OK` if executed correctly.
72+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) if the given key already exists.
73+
74+
{{< /multitabs >}}

content/commands/cms.merge.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,29 @@ Merges several sketches into one sketch. All sketches must have identical width
5353
* **src**: Names of source sketches to be merged.
5454
* **weight**: Multiple of each sketch. Default =1.
5555

56-
## Return
57-
58-
[Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) - `OK` if executed correctly, or [] otherwise.
59-
6056
## Examples
6157

6258
```
6359
redis> CMS.MERGE dest 2 test1 test2 WEIGHTS 1 3
6460
OK
6561
```
62+
63+
## Return information
64+
65+
{{< multitabs id=“cms-merge-return-info"
66+
tab1="RESP2"
67+
tab2="RESP3" >}}
68+
69+
One of the following:
70+
71+
* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) `OK` if executed correctly.
72+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: non-existent key or destination key is not of the same width and/or depth.
73+
74+
-tab-sep-
75+
76+
One of the following:
77+
78+
* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) `OK` if executed correctly.
79+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: non-existent key or destination key is not of the same width and/or depth.
80+
81+
{{< /multitabs >}}

content/commands/cms.query.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,28 @@ Returns the count for one or more items in a sketch.
3838
* **key**: The name of the sketch.
3939
* **item**: One or more items for which to return the count.
4040

41-
## Return
42-
43-
Count of one or more items
44-
45-
[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) with a min-count of each of the items in the sketch.
46-
4741
## Examples
4842

4943
```
5044
redis> CMS.QUERY test foo bar
5145
1) (integer) 10
5246
2) (integer) 42
53-
```
47+
```
48+
49+
{{< multitabs id=“cms-merge-return-info"
50+
tab1="RESP2"
51+
tab2="RESP3" >}}
52+
53+
One of the following:
54+
55+
* [Array]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [integer replies]({{< relref "/develop/reference/protocol-spec#integers" >}}) representing the min-counts of each of the provided items in the sketch.
56+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, missing key, or wrong key type.
57+
58+
-tab-sep-
59+
60+
One of the following:
61+
62+
* [Array]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [integer replies]({{< relref "/develop/reference/protocol-spec#integers" >}}) representing the min-counts of each of the provided items in the sketch.
63+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, missing key, or wrong key type.
64+
65+
{{< /multitabs >}}

0 commit comments

Comments
 (0)