COMMAND GETKEYS

Usage:
COMMAND GETKEYS command [ arg ] [ [ arg ] ... ]
Complexity:
O(N) where N is the number of arguments to the command
Since:
2.8.13

Returns @array-reply of keys from a full Valkey command.

COMMAND GETKEYS is a helper command to let you find the keys from a full Valkey command.

COMMAND provides information on how to find the key names of each command (see firstkey, key specifications, 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 or COMMAND GETKEYSANDFLAGS to discover key names directly from how Valkey parses the commands.

Examples

127.0.0.1:6379> COMMAND GETKEYS MSET a b c d e f
1) "a"
2) "c"
3) "e"
127.0.0.1:6379> COMMAND GETKEYS EVAL "not consulted" 3 key1 key2 key3 arg1 arg2 arg3 argN
1) "key1"
2) "key2"
3) "key3"
127.0.0.1:6379> COMMAND GETKEYS SORT mylist ALPHA STORE outlist
1) "mylist"
2) "outlist"