Redis is a widely used in-memory database which is the most critical layer of a software system. The Redis team releases high-stable versions, updates, and patches consistently to make sure that the software is secure and up to date. Redis team publishes all the new releases in the following GitHub repository and official website downloads page:
Redis official Github Repo : https://github.com/redis/redis
Redis official downloads page : https://redis.io/download/
It is August 2022 now and the current stable release is version 7.0.
Most Fun Way to Check the Installed Redis Version
As usual, Redis offers a command to check the currently installed Redis version. The interesting thing about this command is it generates computer art for different Redis versions. The most fun thing is it generates different versions of base art that depend on the provided arguments.
The LOLWUT Command
Redis introduces the LOLWUT command from version 5.0 that can be used to check the currently installed Redis version. As mentioned, the command executes with a side effect where it displays a generative computer art in the CLI. This art is specific to a given Redis version. An informative blog post is published by the creator of this in the following post:
The syntax of the LOLWUT command is as follows:
VERSION: A specific Redis version to pass as an integer.
If you have not specified the VERSION argument, the LOLWUT command displays the currently installed or remotely connected Redis version.
The first version of the LOLWUT command came out in version 5.0 and it is an open request to the community to implement the LOLWUT command for future releases. There are a few things to keep in mind when implementing the LOLWUT command:
- The LOLWUT command must display the Redis version at the end. Other than that, other outputs should be completely useless.
- Redis LOLWUT shouldn’t introduce the security vulnerabilities and be carefully checked for inputs.
- It should display the generative computer art that can be displayed in a terminal window. Furthermore, it can be a non-graphical one or poetry even.
- The LOLWUT command should work without any performance lag which is an important aspect in the production of Redis instances even with unexpected arguments.
Use Case – Checking the Currently Installed Redis Version
Let’s say you need to check the version of the Redis instance that you are currently connected to via the Redis-CLI. The LOLWUT command can be executed without passing any argument as follows:
As shown in the output, the random computer art is displayed along with the Redis version. In this case, the Redis version is 6.2.6. If you have connected to an earlier Redis version like 5.0, you will get a different computer art.
Specifying the VERSION Argument
The LOLWUT command accepts one argument called version. It is possible to specify the version explicitly with that argument as shown in the following:
In the given example, we explicitly specified the version as 5 which resulted in different computer art specific to that particular version along with the currently installed or connected Redis instance version.
In the previous computer art, the number of squares, lines, rows, and art resolution can be changed by passing the optional parameters.
After the version number argument, you can pass an optional parameter that changes the resolution of the computer-generated art as shown in the following example:
As you can see, the resolution is changed when the parameter is changed from 1 to 15.
We can specify another argument that changes the number of square columns that is shown in the art. Let’s say we need 2 columns in the generated art. It can be done by passing 2 as the next argument.
Let’s change the argument value to 5 which adds 5 columns to the generated art.
In the previous example, the resolution is increased to 20 as well which displays more clear art.
Furthermore, another argument can be passed which sets the number of rows per generated art. The following command generates art that consists of 1 row and 5 lines:
Let’s add 5 lines to the same computer art but with a higher resolution of 25.
There is a pattern of passing the arguments to generate the different versions of base art for Redis version 5.
The following section provides a more generic meaning to the command arguments:
LOLWUT VERSION 5 20 4 10
5 -> Redis version 5.
20 -> The resolution of the generated computer art.
4 -> The number of columns in the generated art.
10 -> The number of rows in the generated art.
All the columns and rows are filled with squares that are matched to the given resolution.
In summary, the LOLWUT command is used to check the version of a given Redis instance. It displays the version as text along with the computer-generated art. The LOLWUT command accepts one optional argument to specify the version number as well. As discussed in the examples, the LOLWUT command accepts more optional parameters that have different meanings from one version to another. The implementation of the LOLWUT command for different versions is open to the community of developers and the command should follow a list of properties which are discussed in the previous sections.