Back to Redis

COMMAND GETKEYSANDFLAGS

content/commands/command-getkeysandflags.md

latest2.0 KB
Original Source

Returns [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of keys from a full Redis command and their usage flags.

COMMAND GETKEYSANDFLAGS is a helper command to let you find the keys from a full Redis command together with flags indicating what each key is used for.

[COMMAND]({{< relref "/commands/command" >}}) provides information on how to find the key names of each command (see firstkey, [key specifications]({{< relref "develop/reference/key-specs#logical-operation-flags" >}}), and movablekeys), but in some cases it's not possible to find keys of certain commands and then the entire command must be parsed to discover some / all key names. You can use [COMMAND GETKEYS]({{< relref "/commands/command-getkeys" >}}) or COMMAND GETKEYSANDFLAGS to discover key names directly from how Redis parses the commands.

Refer to [key specifications]({{< relref "develop/reference/key-specs#logical-operation-flags" >}}) for information about the meaning of the key flags.

Examples

{{% redis-cli %}} COMMAND GETKEYS MSET a b c d e f COMMAND GETKEYS EVAL "not consulted" 3 key1 key2 key3 arg1 arg2 arg3 argN COMMAND GETKEYSANDFLAGS LMOVE mylist1 mylist2 left left {{% /redis-cli %}}

Redis Software and Redis Cloud compatibility

| Redis Software | Redis Cloud | <span style="min-width: 9em; display: table-cell">Notes</span> | |:----------------------|:-----------------|:------| | <span title="Supported">✅ Standard</span> <span title="Supported"><nobr>✅ Active-Active</nobr></span> | <span title="Supported">✅ Standard</span> <span title="Supported"><nobr>✅ Active-Active</nobr></span> | |

Return information

{{< multitabs id="command-getkeysandflags-return-info" tab1="RESP2" tab2="RESP3" >}}

Array reply: a list of keys from the given command and their usage flags.

-tab-sep-

Array reply: a list of keys from the given command and their usage flags.

{{< /multitabs >}}