At RedisConf2016, Redis, the open source, in-memory data structure store, announced the introduction of a new functionality called Redis Modules that allows developers to extend Redis to cover an expanded set of use cases. Redis Modules enable developers to create new database functionality in Redis by means of a Modules API. The modules render Redis extensible by allowing developers to create applications that have access to the Redis core without requiring that the module be rewritten in conjunction with updates to the Redis core. The Modules API for Redis allows Redis Modules to co-exist independently of the evolution of the Redis core such that a module will continue to function irrespective of updates to either the Redis core or the module itself. As noted in a blog post by Salvatore Sanfilippo, the creator of Redis, the vision that gave birth to the evolution of the Redis Module was marked by a desire for sustainable compatibility between the Redis Module and the Redis Core:
What I wanted was an extreme level of API compatibility for the future, so that a module wrote today could work in 4 years from now with the same API, regardless of the changes to the Redis core. I also wanted binary compatibility so that the 4 years old module could even *load* in the new Redis versions and work as expected, without even the need to be recompiled.
Sanfilippo goes on to note that the nature of the API in question required a low level API in contrast to Lua’s high level scripting capabilities:
What we wanted to accomplish was to allow Redis developers to create commands that were as capable as the Redis native commands, and also as fast as the native commands. This cannot be accomplished just with a high level API that calls Redis commands, it’s too slow and limited. There is no point in having a Redis modules system that can just do what Lua can already do. You need to be able to say, get me the value associated with this key, what type is it? Do this low level operation on the value. Given me a cursor into the sorted set at this position, go to the next element, and so forth. To create an API that works as an intermediate layer for such low level access is tricky, but definitely possible.
Here, Sanfllippo remarks on the differentiation of the Redis Module API from the Lua scripting language for Redis by commenting on the need for a fast, low level API that can access the Redis core. Examples of Redis modules that are preliminarily available include an image processing Module and a full text search Module. That said, the code for the Redis Modules API remains unstable and awaits incorporation into an official release of the open source Redis software platform. Nevertheless, Redis Labs, home of Redis and provider of a commercial, enterprise-grade Redis solution, recently announced the release of Modules Hub, a marketplace for Redis Modules that renders available battle-tested, production-grade Redis modules for Redis users. Judging by comments to Salvatore Sanfllippo’s blog post, however, Redis Modules have sparked enthusiasm galore from users as they experiment with the API and mull over its various possibilities.
Learn more about Redis Modules via their API reference manual here.