Multiple Redis databases

Redis comes with support for multiple databases, which is very similar to the concept in SQL databases. In SQL databases, such as MySQL, PostgreSQL, and Oracle, you can define a name for your databases. However, Redis databases are represented by numbers.

You learned in Chapter 4, Commands (Where the Wild Things Are), that we can switch between databases using the command SELECT <dbid>. Although multiple databases work fine, this has become a deprecated feature, so we do not recommend that you use it in production.

It has been deprecated because it is, in general, better to launch multiple Redis servers on the same machine rather than using multiple databases. Redis is single threaded. Thus, a single Redis server with multiple ...

Get Redis Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.