KEYS
Since 1.1.0Keys
Syntax
KEYS patternReturns every key of the current database that matches a glob-style pattern.
| Pattern | Matches |
|---|---|
* | any characters |
? | one character |
[abc], [a-z] | one of those characters |
[^a] | any character but a |
\* | a literal * |
KEYS goes through the whole database in one call, so on a large one it is slow. Use SCAN in applications.
Reply
- An array of key names, in no particular order.
Examples
> MSET user:1 a user:2 b order:1 c
OK
> KEYS user:*
1) "user:2"
2) "user:1"
> KEYS [uo]*:1
1) "order:1"
2) "user:1"