COMMAND(3valkey)
π COMMAND π
okay bestie, deep breath β this is COMMAND(3valkey), straight out of the Valkey Command Manual, and it's the page that spills the tea on literally every command your server knows. it's giving "phone book, but make it cute". let's go π«Ά
π NAME π
command β returns detailed information about all commands.
β¨ SYNOPSIS β¨
COMMAND
π DESCRIPTION π
Returns an array, and inside that array is the full download on every single Valkey command. all of them. no cap.
COMMAND is introspective β its reply describes all the commands the server can actually process. that's why Valkey clients call it during the handshake, to suss out the server's runtime capabilities. vibe check before the friendship starts, basically π
COMMAND also has several subcommands β go peek at those for the extra details, i'm not spoiling them here.
Cluster note, and this one is important: this command is especially beneficial for cluster-aware clients. those clients have to know the names of keys inside commands so they can route requests to the correct shard. and like, most commands do accept a single key as their first argument, but bestie, there are so many exceptions to that rule. so you can call COMMAND and then keep the mapping between commands and their respective key specification rules cached on the client. iconic behaviour honestly.
the reply it returns is an array with one element per command. and each element that describes a Valkey command is represented as an array by itself. arrays inside arrays, she's nested, we love her π¦
the command's array has a fixed number of elements β the exact number depends on the server's version. so don't get comfy assuming, okay?
- Name
- Arity
- Flags
- First key
- Last key
- Step
- ACL categories
[Tips][tb][Key specifications][td]- Subcommands
π NAME π
(yes, the field is called Name, and yes, this section is also called NAME β we're doing that, it's fine)
this is the command's name, in lowercase.
Note: Valkey command names are case-insensitive. lowercase is just how it shows up here.
π’ Arity
Arity is the number of arguments a command expects. the pattern is genuinely simple:
- a positive integer means a fixed number of arguments.
- a negative integer means a minimal number of arguments.
and listen: command arity always includes the command's name itself (plus the subcommand, when there is one).
Examples:
- The arity of
valkey-get(7)GETis2, since the command only accepts one argument and always has the formatGET _key_. - The arity of
valkey-mget(7)MGETis-2, since the command accepts at least one argument, but possibly multiple ones:MGET _key1_ [key2] [key3] ....
π© Flags
Command flags are an array. it can contain the following simple strings (status reply):
adminβ the command is an administrative command.askingβ the command is allowed even during hash slot migration. this flag is relevant in Valkey Cluster deployments.blockingβ the command may block the requesting client.denyoomβ the command is rejected if the server's memory usage is too high (see themaxmemoryconfiguration directive).fastβ the command operates in constant orlog(N)time. this flag is used for monitoring latency with thevalkey-latency(7)LATENCYcommand.loadingβ the command is allowed while the database is loading.movablekeysβ the first key, last key, and step values don't determine all key positions. clients need to usevalkey-command-getkeys(7)COMMAND GETKEYSor[Key specifications][td]in this case. more on this below πno_authβ executing the command doesn't require authentication.no_async_loadingβ the command is denied during asynchronous loading (that is when a replica uses disk-lessvalkey-swapdb(7)SWAPDBvalkey-sync(7)SYNC, and allows access to the old dataset).no_mandatory_keysβ the command may accept key name arguments, but these aren't mandatory.no_multiβ the command isn't allowed inside the context of avalkey-transactions(7)transaction.noscriptβ the command can't be called fromvalkey-eval-intro(7)scripts orvalkey-functions-intro(7)functions.pubsubβ the command is related tovalkey-pubsub(7)Valkey Pub/Sub.randomβ the command returns random results, which is a concern with verbatim script replication. this flag is a[command tip][tb].readonlyβ the command doesn't modify data.sort_for_scriptβ the command's output is sorted when called from a script.skip_monitorβ the command is not shown in the output of thevalkey-monitor(7)MONITORcommand.skip_slowlogβ the command is not shown in the output of thevalkey-slowlog(7)SLOWLOGcommand. this flag is a[command tip][tb].staleβ the command is allowed while a replica has stale data.writeβ the command may modify data.
π Movablekeys
Consider SORT:
1) 1) "sort"
2) (integer) -2
3) 1) write
2) denyoom
3) movablekeys
4) (integer) 1
5) (integer) 1
6) (integer) 1
...
Some Valkey commands have no predetermined key locations, or their key locations are just not easy to find. for those commands, the movablekeys flag is the server saying "yeah, the first key, last key and step values are insufficient to find all the keys". π
here are several examples of commands that have the movablekeys flag:
valkey-sort(7)SORTβ the optionalSTORE,BYandGETmodifiers are followed by names of keys.valkey-zunion(7)ZUNIONβ thenumkeysargument specifies the number key name arguments.valkey-migrate(7)MIGRATEβ the keys appearKEYSkeyword and only when the second argument is the empty string.
so Valkey Cluster clients need to use other measures, as follows, to locate the keys for such commands:
you can use the valkey-command-getkeys(7) COMMAND GETKEYS command and have your Valkey server report all keys of a given command's invocation. very "just tell me directly" of it.
clients can use the key specifications to identify the positions of key names. and here's the fine print: the only commands that require using COMMAND GETKEYS are SORT and MIGRATE, for clients that parse keys' specifications.
for more information, please refer to the [key specifications page][tr].
1οΈβ£ 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.
π Last key
the position of the command's last key name argument. Valkey 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. valkey-brpoplpush(7) BRPOPLPUSH, valkey-smove(7) SMOVE and valkey-rename(7) RENAME β have this value set to the position of their second key.
multi-key commands that accept an arbitrary number of keys, such as valkey-mset(7) MSET, use the value -1.
πͺ 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
...
1) 1) "mget"
2) (integer) -2
3) 1) readonly
2) fast
4) (integer) 1
5) (integer) -1
6) (integer) 1
...
the step count is what lets us find keys' positions. for example valkey-mset(7) MSET: its syntax is MSET _key1_ _val1_ [key2] [val2] [key3] [val3]..., so the keys are at every other position β step value of 2. unlike valkey-mget(7) MGET, which uses a step value of 1. see how that works? π
π ACL categories
this is an array of simple strings β the ACL categories to which the command belongs. please refer to the Access Control List page for more information.
π‘ Command tips
helpful information about the command. to be used by clients/proxies.
please check the [Command tips][tb] page for more information.
ποΈ Key specifications
this is an array consisting of the command's key specifications. each element in the array is a map describing a method for locating keys in the command's arguments.
for more information please check the [key specifications page][td].
πͺ Subcommands
this is an array containing all of the command's subcommands, if any. some Valkey commands have subcommands (e.g., the valkey-config-rewrite(7) REWRITE subcommand of CONFIG). each element in the array represents one subcommand and follows the same specifications as those of COMMAND's reply. it's self-referential, she contains herself, we stan π§
π¬ REPLY π¬
valkey-protocol(7) Array reply: a nested list of command details. and heads up β the order of the commands in the array is random. do not assume an order, bestie, fr fr.
β±οΈ COMPLEXITY β±οΈ
O(N) where N is the total number of commands
ποΈ ACL CATEGORIES ποΈ
@connection @slow
π HISTORY π
- Available since:
2.8.13
π EXAMPLES π
the following is COMMAND's output for the valkey-get(7) GET command:
1) 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
8) (empty array)
9) 1) 1) "flags"
2) 1) read
3) "begin_search"
4) 1) "type"
2) "index"
3) "spec"
4) 1) "index"
2) (integer) 1
5) "find_keys"
6) 1) "type"
2) "range"
3) "spec"
4) 1) "lastkey"
2) (integer) 0
3) "keystep"
4) (integer) 1
5) "limit"
6) (integer) 0
10) (empty array)
...
wait wait wait, don't close the tab β there's more coming in the next part, keep scrolling β¬οΈ
π SEE ALSO π
okay bestie, this is the part where we hand you the whole friend group π«Ά β every single page that lives next to this one. no gatekeeping, no "you'll find out later," just the full roster so you can go read whatever your heart desires. they're all 3valkey pages, so i'm gonna write them exactly how they're written, section-suffix and all, because that part is sacred β¨
the acl girlies π
acl(3valkey)acl-cat(3valkey)acl-deluser(3valkey)acl-dryrun(3valkey)acl-genpass(3valkey)acl-getuser(3valkey)acl-help(3valkey)acl-list(3valkey)acl-load(3valkey)acl-log(3valkey)acl-save(3valkey)acl-setuser(3valkey)acl-users(3valkey)acl-whoami(3valkey)
permissions, users, passwords, logs β the whole access-control cinematic universe π
saving the day πΎ
background vibes only, periodt.
the command introspection squad π
command-count(3valkey)command-docs(3valkey)command-getkeys(3valkey)command-getkeysandflags(3valkey)command-help(3valkey)command-info(3valkey)command-list(3valkey)
yes these are literally the same family as the page you're on rn, they're the cousins at the same table π½οΈ
command log besties π
commandlog(3valkey)commandlog-get(3valkey)commandlog-help(3valkey)commandlog-len(3valkey)commandlog-reset(3valkey)
config, but make it a group chat βοΈ
config(3valkey)config-get(3valkey)config-help(3valkey)config-resetstat(3valkey)config-rewrite(3valkey)config-set(3valkey)
server-side main characters π
dbsize(3valkey)debug(3valkey)failover(3valkey)flushall(3valkey)flushdb(3valkey)info(3valkey)lastsave(3valkey)
the latency committee β±οΈ
latency(3valkey)latency-doctor(3valkey)latency-graph(3valkey)latency-help(3valkey)latency-histogram(3valkey)latency-history(3valkey)latency-latest(3valkey)latency-reset(3valkey)
they're diagnosing your server's sleep schedule and honestly? relatable π
the icon, the legend π¨
no notes. absolute queen behaviour. π
memory lane (literally) π§
memory(3valkey)memory-doctor(3valkey)memory-help(3valkey)memory-malloc-stats(3valkey)memory-purge(3valkey)memory-stats(3valkey)memory-usage(3valkey)
module besties π§©
module(3valkey)module-help(3valkey)module-list(3valkey)module-load(3valkey)module-loadex(3valkey)module-unload(3valkey)
watching, syncing, and other server lore π
monitor(3valkey)psync(3valkey)replconf(3valkey)replicaof(3valkey)restore-asking(3valkey)role(3valkey)save(3valkey)shutdown(3valkey)
slowlog, my beloved π
slowlog(3valkey)slowlog-get(3valkey)slowlog-help(3valkey)slowlog-len(3valkey)slowlog-reset(3valkey)
and the last three, closing us out π
fr fr though β if you're ever stuck, just pick a page off this list and go read it. the docs are your bestie too, i promise. π¦
and that's a wrap on COMMAND(3valkey), bestie!! this whole thing is from the 9.0.0 release, dated 2025-10-21, so if you're reading this and it's somehow still 2025-10-21 somewhere in the world, hi, you're right on time β¨ go forth and command-info your little heart out ππΈπ«Ά
π¦ where this page comes from
- fedora 44: valkey-doc 9.0.3-2.fc44 Β· CC-BY-SA-4.0
- fedora 44: valkey-doc 9.0.6-1.fc44 Β· CC-BY-SA-4.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms