From 026e1603d483ab83739cbc1c597d1b02e459e82e Mon Sep 17 00:00:00 2001 From: Volodymyr Yavdoshenko Date: Tue, 26 Aug 2025 20:23:09 +0300 Subject: [PATCH 1/4] fix: command command and subcommands were updated --- .../server-management/command-count.md | 6 +++ .../server-management/command-help.md | 43 +++++++++++++++++++ .../server-management/command-info.md | 4 +- .../server-management/command.md | 23 ++++++++++ 4 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 docs/command-reference/server-management/command-help.md diff --git a/docs/command-reference/server-management/command-count.md b/docs/command-reference/server-management/command-count.md index 9d4af7d6..6f54bf1f 100644 --- a/docs/command-reference/server-management/command-count.md +++ b/docs/command-reference/server-management/command-count.md @@ -28,3 +28,9 @@ Returns [Integer reply](https://redis.io/docs/latest/develop/reference/protocol- dragonfly> COMMAND COUNT (integer) 240 ``` + +## Tips + +- Counts only non-hidden commands (commands marked with the `HIDDEN` flag are excluded from `COMMAND`). +- Equivalent to the number of elements returned by `COMMAND` without subcommands. +- See also: [`COMMAND`](./command.md), [`COMMAND INFO`](./command-info.md) diff --git a/docs/command-reference/server-management/command-help.md b/docs/command-reference/server-management/command-help.md new file mode 100644 index 00000000..0a13fd2c --- /dev/null +++ b/docs/command-reference/server-management/command-help.md @@ -0,0 +1,43 @@ +--- +description: Learn how to use Redis COMMAND HELP to display usage information for COMMAND subcommands. +--- + +import PageTitle from '@site/src/components/PageTitle'; + +# COMMAND HELP + + + +## Syntax + + COMMAND HELP + +**Time complexity:** O(1) + +**ACL categories:** @slow, @connection + +Return usage information for the supported `COMMAND` subcommands in this Dragonfly server. + +## Return + +[Array reply](https://redis.io/docs/latest/develop/reference/protocol-spec/#arrays): a list of human-readable help lines. + +## Examples + +```shell +dragonfly> COMMAND HELP +1) (no subcommand) +2) Return details about all commands. +3) INFO command-name +4) Return details about specified command. +5) COUNT +6) Return the total number of commands in this server. +``` + +## Tips + +- The help reflects only subcommands currently supported by Dragonfly. +- `COMMAND DOCS` is not implemented and returns an error: "COMMAND DOCS Not Implemented". +- See also: [`COMMAND`](./command.md), [`COMMAND INFO`](./command-info.md), [`COMMAND COUNT`](./command-count.md) + + diff --git a/docs/command-reference/server-management/command-info.md b/docs/command-reference/server-management/command-info.md index 8a902f50..3e29f62b 100644 --- a/docs/command-reference/server-management/command-info.md +++ b/docs/command-reference/server-management/command-info.md @@ -55,7 +55,9 @@ dragonfly> COMMAND INFO UNKNOWN_COMMAND (nil) ``` -## Notes +## Tips - Command names are case-insensitive. +- The reply includes ACL categories as the 7th element; see [`COMMAND`](./command.md) for category semantics and the general reply format. - The output schema is stable but may include more fields in future versions. +- See also: [`COMMAND`](./command.md), [`COMMAND COUNT`](./command-count.md), [`ACL CAT`](../acl/cat.md) diff --git a/docs/command-reference/server-management/command.md b/docs/command-reference/server-management/command.md index 5b5d7284..a567f2eb 100644 --- a/docs/command-reference/server-management/command.md +++ b/docs/command-reference/server-management/command.md @@ -34,6 +34,17 @@ The exact number of elements in the array depends on the server's version. 4. First key 5. Last key 6. Step +7. ACL categories + +## Subcommands + +- [`COMMAND COUNT`](./command-count.md): Return the total number of commands. +- [`COMMAND INFO`](./command-info.md): Return details about a specific command. +- [`COMMAND HELP`](./command-help.md): Show usage information for supported subcommands. + +Unsupported in Dragonfly: + +- `COMMAND DOCS`: Not implemented. The server returns an error ("COMMAND DOCS Not Implemented"). ## Name @@ -71,6 +82,10 @@ Command flags are an array. It can contain the following simple strings (status * **readonly:** the command doesn't modify data. * **write:** the command may modify data. +## Key specifications + +`COMMAND` describes key access using the triplet of positions: first key, last key, and step. See the sections below for details. + ## First key The position of the command's first key name argument. @@ -126,6 +141,14 @@ Unlike `MGET`, which uses a step value of _1_. The order of commands in the array is random. +## Tips + +- Command names are case-insensitive. +- The array includes ACL categories as a trailing nested array (e.g. `@READ`, `@STRING`). +- Hidden commands (with the `HIDDEN` flag) are not returned. +- A step of `2` indicates interleaved key/argument pairs (e.g., `MSET`). +- Use [`COMMAND HELP`](./command-help.md) to discover supported subcommands. `COMMAND DOCS` is not implemented in Dragonfly. + ## Examples The following is `COMMAND`'s output for the `GET` command: From 1d225e8ba3fd048aff40f0e8fd3388f0a03fde33 Mon Sep 17 00:00:00 2001 From: Joe Zhou Date: Tue, 2 Sep 2025 14:19:16 -0400 Subject: [PATCH 2/4] fix: command command minor styling x01 --- .../server-management/command-count.md | 11 +++++++---- .../server-management/command-help.md | 4 +++- .../server-management/command-info.md | 8 ++++++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/docs/command-reference/server-management/command-count.md b/docs/command-reference/server-management/command-count.md index 6f54bf1f..7a06503d 100644 --- a/docs/command-reference/server-management/command-count.md +++ b/docs/command-reference/server-management/command-count.md @@ -16,21 +16,24 @@ import PageTitle from '@site/src/components/PageTitle'; **ACL categories:** @slow, @connection -Returns [Integer reply](https://redis.io/docs/latest/develop/reference/protocol-spec/#integers) of number of total commands in this Dragonfly server. +Returns the number of total commands in this Dragonfly server. ## Return -[Integer reply](https://redis.io/docs/latest/develop/reference/protocol-spec/#integers): number of commands returned by `COMMAND` +[Integer reply](https://redis.io/docs/latest/develop/reference/protocol-spec/#integers): number of commands returned by `COMMAND`. ## Examples ```shell dragonfly> COMMAND COUNT -(integer) 240 +(integer) 283 ``` ## Tips - Counts only non-hidden commands (commands marked with the `HIDDEN` flag are excluded from `COMMAND`). - Equivalent to the number of elements returned by `COMMAND` without subcommands. -- See also: [`COMMAND`](./command.md), [`COMMAND INFO`](./command-info.md) + +## See also + +[`COMMAND`](./command.md) | [`COMMAND INFO`](./command-info.md) diff --git a/docs/command-reference/server-management/command-help.md b/docs/command-reference/server-management/command-help.md index 0a13fd2c..5134013b 100644 --- a/docs/command-reference/server-management/command-help.md +++ b/docs/command-reference/server-management/command-help.md @@ -38,6 +38,8 @@ dragonfly> COMMAND HELP - The help reflects only subcommands currently supported by Dragonfly. - `COMMAND DOCS` is not implemented and returns an error: "COMMAND DOCS Not Implemented". -- See also: [`COMMAND`](./command.md), [`COMMAND INFO`](./command-info.md), [`COMMAND COUNT`](./command-count.md) +## See also + +[`COMMAND`](./command.md) | [`COMMAND INFO`](./command-info.md) | [`COMMAND COUNT`](./command-count.md) diff --git a/docs/command-reference/server-management/command-info.md b/docs/command-reference/server-management/command-info.md index 3e29f62b..d6e1249c 100644 --- a/docs/command-reference/server-management/command-info.md +++ b/docs/command-reference/server-management/command-info.md @@ -58,6 +58,10 @@ dragonfly> COMMAND INFO UNKNOWN_COMMAND ## Tips - Command names are case-insensitive. -- The reply includes ACL categories as the 7th element; see [`COMMAND`](./command.md) for category semantics and the general reply format. +- The reply includes ACL categories as the 7th element. See [`COMMAND`](./command.md) for category semantics and the general reply format. - The output schema is stable but may include more fields in future versions. -- See also: [`COMMAND`](./command.md), [`COMMAND COUNT`](./command-count.md), [`ACL CAT`](../acl/cat.md) + + +## See also + +[`COMMAND`](./command.md) | [`COMMAND COUNT`](./command-count.md) | [`ACL CAT`](../acl/cat.md) From fb32bddd20b2e742a4849b09d383517208e4ca76 Mon Sep 17 00:00:00 2001 From: Joe Zhou Date: Tue, 2 Sep 2025 14:25:10 -0400 Subject: [PATCH 3/4] fix: command command minor styling x02 --- docs/command-reference/server-management/command-help.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/command-reference/server-management/command-help.md b/docs/command-reference/server-management/command-help.md index 5134013b..58977077 100644 --- a/docs/command-reference/server-management/command-help.md +++ b/docs/command-reference/server-management/command-help.md @@ -36,8 +36,8 @@ dragonfly> COMMAND HELP ## Tips -- The help reflects only subcommands currently supported by Dragonfly. -- `COMMAND DOCS` is not implemented and returns an error: "COMMAND DOCS Not Implemented". +- The help lines reflect only subcommands currently supported by Dragonfly. +- For instance, `COMMAND DOCS` is not implemented at the moment and returns an error when called. ## See also From c77d1f115d90fd765f3d05f3a64c6885b3399b89 Mon Sep 17 00:00:00 2001 From: Joe Zhou Date: Tue, 2 Sep 2025 15:22:37 -0400 Subject: [PATCH 4/4] fix: command command minor styling x03 --- .../server-management/command-info.md | 2 +- .../server-management/command.md | 204 +++++++++--------- 2 files changed, 109 insertions(+), 97 deletions(-) diff --git a/docs/command-reference/server-management/command-info.md b/docs/command-reference/server-management/command-info.md index d6e1249c..643953a8 100644 --- a/docs/command-reference/server-management/command-info.md +++ b/docs/command-reference/server-management/command-info.md @@ -58,8 +58,8 @@ dragonfly> COMMAND INFO UNKNOWN_COMMAND ## Tips - Command names are case-insensitive. -- The reply includes ACL categories as the 7th element. See [`COMMAND`](./command.md) for category semantics and the general reply format. - The output schema is stable but may include more fields in future versions. +- See [`COMMAND`](./command.md) for the general reply format. ## See also diff --git a/docs/command-reference/server-management/command.md b/docs/command-reference/server-management/command.md index a567f2eb..f325b9c6 100644 --- a/docs/command-reference/server-management/command.md +++ b/docs/command-reference/server-management/command.md @@ -22,144 +22,156 @@ The `COMMAND` command is introspective. Its reply describes all commands that the server can process. Clients can call it to obtain the server's runtime capabilities during the handshake. -The reply it returns is an array with an element per command. -Each element that describes a Dragonfly command is represented as an array by itself. - -The command's array consists of a fixed number of elements. -The exact number of elements in the array depends on the server's version. - -1. Name -2. Arity -3. Flags -4. First key -5. Last key -6. Step -7. ACL categories - ## Subcommands +- [`COMMAND HELP`](./command-help.md): Show usage information for supported subcommands. - [`COMMAND COUNT`](./command-count.md): Return the total number of commands. - [`COMMAND INFO`](./command-info.md): Return details about a specific command. -- [`COMMAND HELP`](./command-help.md): Show usage information for supported subcommands. Unsupported in Dragonfly: -- `COMMAND DOCS`: Not implemented. The server returns an error ("COMMAND DOCS Not Implemented"). +- `COMMAND DOCS`: Not implemented. The server returns an error. -## Name +--- -This is the command's name in lowercase. +## Return -**Note:** -Command names are case-insensitive. +[Array reply](https://redis.io/docs/latest/develop/reference/protocol-spec/#arrays): a nested list of command details. +The order of commands in the array is random. -## Arity +The reply is an array with **an element per command**. +Each element that describes a Dragonfly command is represented as a fixed-length array by itself. +The exact number of elements in the command's array depends on the server's version. -Arity is the number of arguments a command expects. -It follows a simple pattern: +1. Name +2. Arity +3. Flags +4. First key +5. Last key +6. Step +7. ACL categories -* A positive integer means a fixed number of arguments. -* A negative integer means a minimal number of arguments. +### Name -Command arity _always includes_ the command's name itself (and the subcommand when applicable). +This is the command's name. Note that command names are case-insensitive. -Examples: +### Arity -* `GET`'s arity is _2_ since the command only accepts one argument and always has the format `GET _key_`. -* `MGET`'s arity is _-2_ since the command accepts at least one argument, but possibly multiple ones: `MGET _key1_ [key2] [key3] ...`. +Arity is the number of arguments a command expects. +It follows a simple pattern: + +- A positive integer means a fixed number of arguments. +- A negative integer means a minimal number of arguments. -## Flags +Command arity **always includes** the command's name itself (and the subcommand when applicable). +For example: -Command flags are an array. It can contain the following simple strings (status reply): +- `GET`'s arity is `2` since the command only accepts one argument and always has the format `GET key`. +- `MGET`'s arity is `-2` since the command accepts at least one argument but possibly multiple ones: `MGET key [key ...]`. -* **admin:** the command is an administrative command. -* **blocking:** the command may block the requesting client. -* **denyoom**: the command is rejected if the server's memory usage is too high (see the _maxmemory_ configuration directive). -* **fast:** the command operates in constant or log(N) time. - This flag is used for monitoring latency with the `LATENCY` command. -* **loading:** the command is allowed while the database is loading. -* **noscript:** the command can't be called from [scripts](https://redis.io/docs/latest/develop/interact/programmability/eval-intro/). -* **readonly:** the command doesn't modify data. -* **write:** the command may modify data. +### Flags -## Key specifications +Command flags are returned as an array. It can contain the following simple strings (status reply): -`COMMAND` describes key access using the triplet of positions: first key, last key, and step. See the sections below for details. +- `admin`: The command is an administrative command. +- `blocking`: The command may block the requesting client. +- `denyoom`: The command is rejected if the server's memory usage is too high + (see the [`maxmemory`](../../managing-dragonfly/flags#--maxmemory) configuration directive). +- `fast`: The command operates in constant or log(N) time. +- `loading`: The command is allowed while the database is loading. +- `noscript`: The command can't be called from [scripts](https://redis.io/docs/latest/develop/interact/programmability/eval-intro/). +- `readonly`: The command doesn't modify data. +- `write`: The command may modify data. -## First key +### First key The position of the command's first key name argument. -For most commands, the first key's position is 1. -Position 0 is always the command name itself. +For most commands, the first key's position is `1`. +Position `0` is always the command name itself. -## Last key +### Last key The position of the command's last key name argument. -Commands usually accept one, two or multiple number of keys. - -Commands that accept a single key have both _first key_ and _last key_ set to 1. - -Commands that accept two key name arguments, e.g. `BRPOPLPUSH`, `SMOVE` and `RENAME`, have this value set to the position of their second key. - -Multi-key commands that accept an arbitrary number of keys, such as `MSET`, use the value -1. +Commands usually accept one, two, or multiple number of keys. +- Commands that accept a single key have both the **first key** and the **last key** set to `1`. +- Commands that accept two key name arguments (e.g., `SMOVE`) have this value set to the position of their second key. +- Multi-key commands that accept an arbitrary number of keys (e.g., `MSET`) have the value `-1`. -## Step - -The step, or increment, between the _first key_ and the position of the next key. +### Step +The step, or increment, between the first key and the position of the next key. Consider the following two examples: -``` -1) 1) "mset" - 2) (integer) -3 - 3) 1) write - 2) denyoom - 4) (integer) 1 - 5) (integer) -1 - 6) (integer) 2 - ... +```bash +dragonfly> COMMAND +# ... +1) MSET +2) (integer) -3 +3) 1) write + 2) denyoom + 3) interleaved-keys + 4) custom-journal +4) (integer) 1 +5) (integer) -1 +6) (integer) 2 +7) 1) @WRITE + 2) @STRING + 3) @SLOW +# ... ``` -``` -1) 1) "mget" - 2) (integer) -2 - 3) 1) readonly - 2) fast - 4) (integer) 1 - 5) (integer) -1 - 6) (integer) 1 - ... +```bash +dragonfly> COMMAND +# ... +1) MGET +2) (integer) -2 +3) 1) readonly + 2) fast + 3) idempotent +4) (integer) 1 +5) (integer) -1 +6) (integer) 1 +7) 1) @READ + 2) @STRING + 3) @FAST +# ... ``` The step count allows us to find keys' positions. -For example `MSET`: Its syntax is `MSET _key1_ _val1_ [key2] [val2] [key3] [val3]...`, so the keys are at every other position (step value of _2_). -Unlike `MGET`, which uses a step value of _1_. - -## Return - -[Array reply](https://redis.io/docs/latest/develop/reference/protocol-spec/#arrays): a nested list of command details. +- For example, the `MSET` command has a syntax of `MSET key1 val1 [key2] [val2] [key3] [val3]...`, + so the keys are at every other position, which has a step value of `2`. +- For the `MGET` command with a syntax of `MGET key1 [key2] [key3]...`, it uses a step value of `1`. -The order of commands in the array is random. +### ACL categories -## Tips +Command ACL categories are returned as an array. +For instance, the `MSET` command shown above is categorized as `@write`, `@string`, and `@slow` from the ACL perspective. +Learn more about [ACL rules](../acl/setuser.md) to control your data store access. -- Command names are case-insensitive. -- The array includes ACL categories as a trailing nested array (e.g. `@READ`, `@STRING`). -- Hidden commands (with the `HIDDEN` flag) are not returned. -- A step of `2` indicates interleaved key/argument pairs (e.g., `MSET`). -- Use [`COMMAND HELP`](./command-help.md) to discover supported subcommands. `COMMAND DOCS` is not implemented in Dragonfly. +--- ## Examples The following is `COMMAND`'s output for the `GET` command: +```bash +dragonfly> COMMAND +# ... +1) GET # Name +2) (integer) 2 # Arity +3) 1) readonly # Flags (array) + 2) fast +4) (integer) 1 # First key +5) (integer) 1 # Last key +6) (integer) 1 # Step +7) 1) @READ # ACL categories (array) + 2) @STRING + 3) @FAST +# ... ``` -1) 1) "get" - 2) (integer) 2 - 3) 1) readonly - 2) fast - 4) (integer) 1 - 5) (integer) 1 - 6) (integer) 1 -... -``` + +## Tips + +- Command names are case-insensitive. +- Hidden commands (with the `HIDDEN` flag) are not returned. +- Use [`COMMAND HELP`](./command-help.md) to discover supported subcommands.