Skip to content

KEYS

KEYS pattern

KEYS returns all keys matching the pattern.

The pattern can contain the following special characters to match multiple keys. Supports glob-style patterns:

  • *: matches any sequence of characters
  • ?: matches any single character
localhost:7379> SET k1 v1
OK
localhost:7379> SET k2 v2
OK
localhost:7379> SET k33 v33
OK
localhost:7379> KEYS k?
OK
0) k1
1) k2
localhost:7379> KEYS k*
OK
0) k1
1) k2
2) k33
localhost:7379> KEYS *
OK
0) k1
1) k2
2) k33