How it works...

Loading a Redis module is quite simple; when a module has been successfully loaded, we can also see it from Redis Server logs:

1960:M 29 Dec 18:31:07.403 # <ReJSON> JSON data type for Redis v1.0.1 [encver 0]
1960:M 29 Dec 18:31:07.403 * Module 'ReJSON' loaded from /redis/rejson/src/rejson.so  

The MODULE UNLOAD command takes the module name instead of the module library file path and it is good practice to keep the module library filename the same as the module name.

In the preceding example, since the ReJSON module created a new data type, it could not be unloaded at runtime. If a module is loaded by the MODULE LOAD command, it will be unloaded automatically when the server stops.

Get Redis 4.x Cookbook 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.