-
Notifications
You must be signed in to change notification settings - Fork 274
DOC-5718: add new string commands #2307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
97d8999
Initial commit
dwdougherty 6b32e08
DOC-5718: add new string commands
dwdougherty ce130e5
Apply code review suggestions
dwdougherty 2f8cb38
Apply more code review suggestions
dwdougherty 21e64e9
Apply yet more code review suggestions
dwdougherty File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| --- | ||
| acl_categories: | ||
| - '@write' | ||
| - '@string' | ||
| - '@fast' | ||
| arguments: | ||
| - display_text: key | ||
| key_spec_index: 0 | ||
| name: key | ||
| type: key | ||
| - arguments: | ||
| - display_text: ifeq-value | ||
| name: ifeq-value | ||
| token: IFEQ | ||
| type: string | ||
| - display_text: ifne-value | ||
| name: ifne-value | ||
| token: IFNE | ||
| type: string | ||
| - display_text: ifdeq-digest | ||
| name: ifdeq-digest | ||
| token: IFDEQ | ||
| type: integer | ||
| - display_text: ifdne-digest | ||
| name: ifdne-digest | ||
| token: IFDNE | ||
| type: integer | ||
| name: condition | ||
| optional: true | ||
| type: oneof | ||
| arity: -2 | ||
| categories: | ||
| - docs | ||
| - develop | ||
| - stack | ||
| - oss | ||
| - rs | ||
| - rc | ||
| - oss | ||
| - kubernetes | ||
| - clients | ||
| command_flags: | ||
| - write | ||
| - fast | ||
| complexity: O(1) for IFEQ/IFNE, O(N) for IFDEQ/IFDNE where N is the length of the string value. | ||
| description: Conditionally removes the specified key based on value or hash digest comparison. | ||
| group: string | ||
| hidden: false | ||
| key_specs: | ||
| - RW: true | ||
| begin_search: | ||
| spec: | ||
| index: 1 | ||
| type: index | ||
| delete: true | ||
| find_keys: | ||
| spec: | ||
| keystep: 1 | ||
| lastkey: 0 | ||
| limit: 0 | ||
| type: range | ||
| linkTitle: DELEX | ||
| since: 8.4.0 | ||
| summary: Conditionally removes the specified key based on value or hash digest comparison. | ||
| syntax_fmt: "DELEX key [IFEQ\_ifeq-value | IFNE\_ifne-value | IFDEQ\_ifdeq-digest\ | ||
| \ |\n IFDNE\_ifdne-digest]" | ||
| syntax_str: "[IFEQ\_ifeq-value | IFNE\_ifne-value | IFDEQ\_ifdeq-digest | IFDNE\_\ | ||
| ifdne-digest]" | ||
| title: DELEX | ||
| --- | ||
|
|
||
| Conditionally removes the specified key based on value or hash digest comparison. | ||
|
|
||
| ## Hash Digest | ||
|
|
||
| A hash digest is a fixed-size numerical representation of a string value, computed using the XXH3 hash algorithm. Redis uses this hash digest for efficient comparison operations without needing to compare the full string content. You can retrieve a key's hash digest using the [`DIGEST`]({{< relref "/commands/digest" >}}) command, which returns it as a hexadecimal string that you can use with the `IFDEQ` and `IFDNE` options, and also the [`SET`]({{< relref "/commands/set" >}}) command's `IFDEQ` and `IFDNE` options. | ||
|
|
||
| ## Options | ||
|
|
||
| The DELEX command supports a set of options that modify its behavior. | ||
| Only one of the options can be specified. | ||
|
|
||
| * `IFEQ ifeq-value` -- Remove the key if the value is equal to the specified value. | ||
| * `IFNE ifne-value` -- Remove the key if the value is not equal to the specified value. | ||
| * `IFDEQ ifeq-digest` -- Remove the key if its hash digest is equal to the specified hash digest. | ||
| * `IFDNE ifne-digest` -- Remove the key if its hash digest is not equal to the specified hash digest. | ||
|
|
||
| In 8.4, keys must be of type string when using one of the options above. If no options are specified, the key is removed regardless of its type. | ||
|
|
||
| ## Return information | ||
|
|
||
| {{< multitabs id="return-info" | ||
| tab1="RESP2" | ||
| tab2="RESP3" >}} | ||
|
|
||
| One of the following: | ||
| - [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): 0 if not deleted (the key does not exist or a specified `IFEQ/IFNE/IFDEQ/IFDNE` condition is false), or 1 if deleted. | ||
| - [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) if the key exists but holds a value that is not a string and one of `IFEQ, IFNE, IFDEQ,` or `IFDNE` is specified. | ||
|
|
||
| -tab-sep- | ||
|
|
||
| One of the following: | ||
| - [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): 0 if not deleted (the key does not exist or a specified `IFEQ/IFNE/IFDEQ/IFDNE` condition is false), or 1 if deleted. | ||
| - [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) if the key exists but holds a value that is not a string and one of `IFEQ, IFNE, IFDEQ,` or `IFDNE` is specified. | ||
|
|
||
| {{< /multitabs >}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| --- | ||
| acl_categories: | ||
| - '@read' | ||
| - '@string' | ||
| - '@fast' | ||
| arguments: | ||
| - display_text: key | ||
| key_spec_index: 0 | ||
| name: key | ||
| type: key | ||
| arity: 2 | ||
| categories: | ||
| - docs | ||
| - develop | ||
| - stack | ||
| - oss | ||
| - rs | ||
| - rc | ||
| - oss | ||
| - kubernetes | ||
| - clients | ||
| command_flags: | ||
| - readonly | ||
| - fast | ||
| complexity: O(N) where N is the length of the string value. | ||
| description: Returns the hash digest of a string value. | ||
| group: string | ||
| hidden: false | ||
| key_specs: | ||
| - RO: true | ||
| access: true | ||
| begin_search: | ||
| spec: | ||
| index: 1 | ||
| type: index | ||
| find_keys: | ||
| spec: | ||
| keystep: 1 | ||
| lastkey: 0 | ||
| limit: 0 | ||
| type: range | ||
| linkTitle: DIGEST | ||
| since: 8.4.0 | ||
| summary: Returns the hash digest of a string value as a hexadecimal string. | ||
| syntax_fmt: DIGEST key | ||
| syntax_str: '' | ||
| title: DIGEST | ||
| --- | ||
|
|
||
| Get the hash digest for the value stored in the specified key as a hexadecimal string. Keys must be of type string. | ||
|
|
||
| ## Hash Digest | ||
|
|
||
| A hash digest is a fixed-size numerical representation of a string value, computed using the XXH3 hash algorithm. Redis uses this hash digest for efficient comparison operations without needing to compare the full string content. You can use these hash digests with the [SET]({{< relref "/commands/set" >}}) command's `IFDEQ` and `IFDNE` options, and also the [DELEX]({{< relref "/commands/delex" >}}) command's `IFDEQ` and `IFDNE` options. | ||
|
|
||
| ## Return information | ||
|
|
||
| {{< multitabs id="return-info" | ||
| tab1="RESP2" | ||
| tab2="RESP3" >}} | ||
|
|
||
| One of the following: | ||
|
|
||
| - [Null bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) if the key does not exist. | ||
| - [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) if the key exists but holds a value which is not a string. | ||
| - [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) the hash digest of the value stored in the key as a hexadecimal string. | ||
|
|
||
| -tab-sep- | ||
|
|
||
| One of the following: | ||
|
|
||
| - [Null bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) if the key does not exist. | ||
| - [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) if the key exists but holds a value which is not a string. | ||
| - [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) the hash digest of the value stored in the key as a hexadecimal string. | ||
|
|
||
| {{< /multitabs >}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.