redis get all keys code example
Example 1: redis show all keys
$ redis-cli
> KEYS *
1) "title:1"
2) "title:2"
3) "title"
4) "author:2"
5) "author"
6) "author:1"
Example 2: scan and print all keys redis shell
# From shell
redis-cli --raw keys "KeyPrefix*"
# or
redis-cli --scan --pattern "KeyPrefix*"
Example 3: redis get keys
KEYS * # blocks the server
scan NUM # NUM is the page/cursor number (start with 0)