- Ubuntu
- Package management
- here
Redis-server installation --Redis server fast storage of volatile data and Pub / Sub
To install the Redis server, install the redis-server package with the apt command.
sudo apt install -y redis-server
Confirm that the Redis server is installed
Let's confirm that the Redis server is installed with the status command of systemctl.
sudo systemctl status redis-server
Redis client --redis-cli
Installing the Redis server also installs a command-line application called redis-cli that allows you to run Redis commands.
Use of Redis server
Redis servers have two main uses.
High-speed storage of volatile data h4>
Redis servers can store volatile data at high speeds.
Volatile data is data that is temporary and is scheduled to be erased.
The session information will be erased for a certain period of time, and if it disappears, you just have to ask the user to start over from the login screen. Session information is volatile data.
Also, since the session must be fetched for each HTTP request, Redis performs better than a relational database like MariaDB. Is good.
Pub / Sub push notifications
Redis has a push notification mechanism called Pub / Sub, so it's relatively easy to implement in the areas of real-time chat and real-time updates.
Redis has a web API, so if your web framework supports non-blocking, you can access Redis with a non-blocking HTTP request.
Please refer to the following for a sample of real-time chat using Mojolicious, WebSocket, and Redis.