VALKEY-COMMAND-TIPS(7)
๐ VALKEY-COMMAND-TIPS(7) ๐
okay bestie, welcome to the glow-up guide for valkey-command-tips โ the page that explains Command tips. yes it's a manual page, no it's not boring, come with me ๐ซถ
โจ NAME โจ
valkey-command-tips โ Command tips (yes that's the whole name, she's simple and she's iconic)
๐ธ DESCRIPTION ๐ธ
so this page documents a small part of the reply of command(3valkey). Like, a lil slice. A garnish. ๐
In the reply of the COMMAND command, each command is represented by an array. The 8th element in this array is the command tips. It's an array of strings. that's her. that's the girl.
These tips give Valkey clients extra info about the command. The info can tell Valkey Cluster clients how the command should be executed and how its output should be processed in a clustered deployment. basically: cluster client instructions, no cap.
Now โ unlike the command's flags (that's the 3rd element of command(3valkey)'s reply), which are strictly internal to the server's operation, tips don't serve any purpose other than being reported to clients. so if you're like "why do these exist", it's literally just to be handed to the client. that's it. she's a messenger ๐
๐ฒ nondeterministic_output
This tip says: the command's output isn't deterministic. Which means calls to the command may yield different results even with the same arguments and data. ๐ญ
That difference could come from:
- the command's random nature (e.g.,
RANDOMKEYandSPOP) - the call's timing (e.g.,
TTL) - or generic differences that relate to the server's state (e.g.,
INFOandCLIENT LIST)
Note: Prior to Redis OSS 7.0, this tip was the random command flag.
๐ nondeterministic_output_order
The existence of this tip indicates that the command's output is deterministic, but its ordering is random (e.g., HGETALL and SMEMBERS). so the vibes are consistent but the lineup is shuffled. main character energy, no fixed seating chart โจ
Note: Prior to Redis OSS 7.0, this tip was the sort_for_script flag.
๐ฎ request_policy:value
This tip can help clients figure out which shards to send the command to in clustering mode. ๐บ๏ธ
The default behavior a client should implement for commands without the request_policy tip is as follows:
- The command doesn't accept key name arguments: the client can execute the command on an arbitrary shard.
- For commands that accept one or more key name arguments: the client should route the command to a single shard, as determined by the hash slot of the input keys.
In cases where the client should adopt a behavior different than the default, the request_policy tip can be one of:
all_nodesโ the client should execute the command on all nodes โ primaries and replicas alike. An example is theCONFIG SETcommand. This tip is in-use by commands that don't accept key name arguments. The command operates atomically per shard.all_shardsโ the client should execute the command on all primary shards (e.g., theDBSIZEcommand). This tip is in-use by commands that don't accept key name arguments. The command operates atomically per shard.multi_shardโ the client should execute the command on several shards. The client should split the inputs according to the hash slots of its input key name arguments. For example, the commandDEL {foo} {foo}1 barshould be split toDEL {foo} {foo}1andDEL bar. If the keys are hashed to more than a single slot, the command must be split even if all the slots are managed by the same shard. Examples for such commands includeMSET,MGETandDEL. However, note thatSUNIONSTOREisn't considered asmulti_shardbecause all of its keys must belong to the same hash slot.specialโ indicates a non-trivial form of the client's request policy, such as theSCANcommand.
๐งฎ response_policy:value
This tip can help clients determine the aggregate they need to compute from the replies of multiple shards in a cluster. ๐
The default behavior for commands without a request_policy tip only applies to replies with of nested types (i.e., an array, a set, or a map). The client's implementation for the default behavior should be as follows:
- The command doesn't accept key name arguments: the client can aggregate all replies within a single nested data structure. For example, the array replies we get from calling
KEYSagainst all shards. These should be packed in a single in no particular order. - For commands that accept one or more key name arguments: the client needs to retain the same order of replies as the input key names. For example,
MGET's aggregated reply.
The response_policy tip is set for commands that reply with scalar data types, or when it's expected that clients implement a non-default aggregate. This tip can be one of:
one_succeededโ the clients should return success if at least one shard didn't reply with an error. The client should reply with the first non-error reply it obtains. If all shards return an error, the client can reply with any one of these. For example, consider aSCRIPT KILLcommand that's sent to all shards. Although the script should be loaded in all of the cluster's shards, theSCRIPT KILLwill typically run only on one at a given time.all_succeededโ the client should return successfully only if there are no error replies. Even a single error reply should disqualify the aggregate and be returned. Otherwise, the client should return one of the non-error replies. As an example, consider theCONFIG SET,SCRIPT FLUSHandSCRIPT LOADcommands.agg_logical_andโ the client should return the result of a logicalANDoperation on all replies (only applies to integer replies, usually from commands that return either0or1). Consider theSCRIPT EXISTScommand as an example. It returns an array of0's and1's that denote the existence of its given SHA1 sums in the script cache. The aggregated response should be1only when all shards had reported that a given script SHA1 sum is in their respective cache.agg_logical_orโ the client should return the result of a logicalANDoperation on all replies (only applies to integer replies, usually from commands that return either0or1). (yes bestie, the page saysANDhere. I'm just reporting what she said. ๐)agg_minโ the client should return the minimal value from the replies (only applies to numerical replies). The aggregate reply from a cluster-wideWAITcommand, for example, should be the minimal value (number of synchronized replicas) from all shards.agg_maxโ the client should return the maximal value from the replies (only applies to numerical replies).agg_sumโ the client should return the sum of replies (only applies to numerical replies). Example:DBSIZE.specialโ this type of tip indicates a non-trivial form of reply policy.INFOis an excellent example of that.
๐ Example
127.0.0.1:6379> command info ping
1) 1) "ping"
2) (integer) -1
3) 1) fast
4) (integer) 0
5) (integer) 0
6) (integer) 0
7) 1) @fast
2) @connection
8) 1) "request_policy:all_shards"
2) "response_policy:all_succeeded"
9) (empty array)
10) (empty array)
and that's the whole page, you ate it, you devoured ๐ โจ
Valkey 9.0.0 ๐ธ 2025-10-21 โ mwah, love u, go read command(3valkey) next, iykyk ๐ฆ๐
๐ฆ 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