COMMAND INFO
COMMAND INFO [command-name [command-name ...]]
- Group
- Server
- Complexity
- O(N) where N is the number of commands asked about
- Arity
- -2 (at least 2 words, counting the command name)
- HotKV Cloud
- All plans
- On-Premise
- no license needed
COMMAND INFO describes the commands you name, or every command if you name
none (the same as COMMAND alone). Names are
case-insensitive. Client libraries use the key positions to route commands
in a cluster, and the flags to know, for example, which commands may be sent
to a replica.
Return value
Section titled “Return value”An array with one entry per name asked about, in the same order. An unknown name gives a nil (RESP2) or null (RESP3) entry. Each entry is an array of seven elements:
| # | Element | Meaning |
|---|---|---|
| 1 | Name | The command name in lower case. |
| 2 | Arity | The number of arguments including the command name. A negative number -N means at least N. |
| 3 | Flags | Such as write, readonly, denyoom, admin, pubsub, noscript, blocking, loading, stale, fast, no_auth, movablekeys. A set in RESP3, an array in RESP2. |
| 4 | First key | Position of the first key argument, 0 if there are none. |
| 5 | Last key | Position of the last key argument; negative counts from the end (-1 is the last argument). |
| 6 | Step | Distance between key arguments. |
| 7 | ACL categories | Such as @read, @string, @fast. A set in RESP3, an array in RESP2. |
As in Redis, container commands such as CONFIG or CLIENT report no flags
of their own, and movablekeys marks commands whose key positions depend on
their arguments (for those, ask COMMAND GETKEYS).
Examples
Section titled “Examples”127.0.0.1:6379> COMMAND INFO get mset nosuch1) 1) "get" 2) (integer) 2 3) 1) "readonly" 2) "fast" 4) (integer) 1 5) (integer) 1 6) (integer) 1 7) 1) "@read" 2) "@string" 3) "@fast"2) 1) "mset" 2) (integer) -3 3) 1) "write" 4) (integer) 1 5) (integer) -1 6) (integer) 2 7) 1) "@write" 2) "@string" 3) "@slow"3) (nil)Compatibility
Section titled “Compatibility”Redis 7 and Valkey 8 return three more elements per entry: command tips, key specifications and subcommands. HotKV returns the first seven, which older and current client libraries use for routing.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.