Storing search data in Redis
Redis is a fast, open source, in-memory, key-value form of NoSQL storage that’s popular in messaging and caching. In Chapter 5, we used it as the message broker of Celery, while in Chapter 6, we used it as a message queue for the SSE and WebSocket programming. However, this chapter will utilize Redis as a data cache to create a fast search mechanism.
First, let’s install Redis on our system.
Installing the Redis server
For Windows, download the latest Redis TAR file from https://redis.io/download/, unzip it to an installation folder, and run redis-server.exe
from the directory.
For WSL, run the following series of sudo
commands:
sudo apt-add-repository ppa:redislabs/redis sudo apt-get update sudo apt-get upgrade sudo apt-get install redis-server
Then, run redis-cli -v
to check if the installation was successful. If so, run the redis-server
command to start the Redis server. Figure 7.13 shows the server log after the Redis...