O'Reilly logo

Redis 4.x Cookbook by Zuofei Wang, Pengcheng Huang

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works...

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() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required