RedisGears is an engine for data processing in Redis. RedisGears supports batch and event-driven processing for Redis data. To use RedisGears, you write functions that describe how your data should be processed. You then submit this code to your Redis deployment for remote execution.
RedisGears is implemented by a Redis module. To use RedisGears, you’ll need to make sure that your Redis deployment has the module installed.
Before you can use RedisGears, you have to install the RedisGears module. We will be using redislabs/redismod Docker image for this demonsration
You can directly use
redis-cli CLI to verify if RedisGears module("rg") is properly loaded or not.
To demonstrate RedisGears functionality, we will be performing a unique word count on the existing strings. We will be writing a RedisGears function to do this.
Open a file called wordcount.py, and add the following code:
The results here show the number of occurences of each word in all of our strings. So, we’ve effectively processed the data in our Redis database all at once, in a batch.
- Learn more about RedisGears in the Quick Start tutorial.