How it works...
Keys management in Redis is quite simple. However, some APIs may become performance killers.
Firstly, you may find that if there are quite a large number of keys in Redis, calling KEYS will make the Redis Server block for a while until all the keys have returned (it took 6.8 s in our example). If you understood the core concept in the recipe Understanding the Redis Event Model in Chapter 1, Getting Started with Redis, you will know that during one command execution in Redis, all the other commands the server has already received have to wait to be processed. Therefore, calling the KEYS command is a dangerous action for the performance of a production environment. For this issue, the command SCAN, like HSCAN or SSCAN as mentioned ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access