The RedisModule_OnLoad() function is called when a module is loaded in Redis. It must be implemented in every Redis module as it is the entry-point. Usually, we need to initialize the module first with the API RedisModule_Init() and specify the module name, version, and API version. Redis modules are designed to be agnostic of Redis Server versions, but they have to be compliant with an API version. That is, a module does not need to be recompiled in order to be loaded in a different version of Redis Server, as long as the server knows which API version the module is using. The current Redis module API version is 1 (REDISMODULE_APIVER_1). We also need to create commands for the module, which is done by the function RedisModule_CreateCommand() ...
How it works...
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.