• Stars
    star
    177
  • Rank 215,985 (Top 5 %)
  • Language
    C
  • License
    MIT License
  • Created over 8 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Tools, utilities and scripts to help you write redis modules!

RedisModulesSDK

This little repo is here to help you write Redis modules a bit more easily.

What it includes:

1. redismodule.h

The only file you really need to start writing Redis modules. Either put this path into your module's include path, or copy it.

Notice: This is an up-to-date copy of it from the Redis repo.

2. LibRMUtil

A small library of utility functions and macros for module developers, including:

  • Easier argument parsing for your commands.
  • Testing utilities that allow you to wrap your module's tests as a redis command.
  • RedisModuleString utility functions (formatting, comparison, etc)
  • The entire sds string library, lifted from Redis itself.
  • A generic scalable Vector library. Not redis specific but we found it useful.
  • A few other helpful macros and functions.
  • alloc.h, an include file that allows modules implementing data types to implicitly replace the malloc() function family with the Redis special allocation wrappers.

It can be found under the rmutil folder, and compiles into a static library you link your module against.

3. An example Module

A minimal module implementing a few commands and demonstarting both the Redis Module API, and use of rmutils.

You can treat it as a template for your module, and extend its code and makefile.

It includes 3 commands:

  • EXAMPLE.PARSE - demonstrating rmutil's argument helpers.
  • EXAMPLE.HGETSET - an atomic HGET/HSET command, demonstrating the higher level Redis module API.
  • EXAMPLE.TEST - a unit test of the above commands, demonstrating use of the testing utilities of rmutils.

4. Documentation Files:

  1. API.md - The official manual for writing Redis modules, copied from the Redis repo. Read this before starting, as it's more than an API reference.

  2. FUNCTIONS.md - Generated API reference documentation for both the Redis module API, and LibRMUtil.

  3. TYPES.md - Describes the API for creating new data structures inside Redis modules, copied from the Redis repo.

  4. BLOCK.md - Describes the API for blocking a client while performing asynchronous tasks on a separate thread.

Quick Start Guide

Here's what you need to do to build your first module:

  1. Build Redis in a build supporting modules.
  2. Build librmutil and the module by running make. (you can also build them seperatly by running make in their respective dirs)
  3. Run redis loading the module: /path/to/redis-server --loadmodule ./module.so

Now run redis-cli and try the commands:

127.0.0.1:9979> EXAMPLE.HGETSET foo bar baz
(nil)
127.0.0.1:9979> EXAMPLE.HGETSET foo bar vaz
"baz"
127.0.0.1:9979> EXAMPLE.PARSE SUM 5 2
(integer) 7
127.0.0.1:9979> EXAMPLE.PARSE PROD 5 2
(integer) 10
127.0.0.1:9979> EXAMPLE.TEST
PASS

Enjoy!

More Repositories

1

redisml

Machine Learning Model Server
C
305
star
2

redismodule-rs

Rust API for Redis Modules API
Rust
269
star
3

redismod

A Docker image with select Redis Labs modules
127
star
4

redex

Extension modules to Redis' native data types and commands
C
69
star
5

countminsketch

An apporximate frequency counter Redis module
C
46
star
6

RedisEdge

Docker image with select Redis Labs modules for the Edge
Dockerfile
39
star
7

topk

An almost deterministic top k elements counter Redis module
C
35
star
8

secondary

Redis Secondary Indexing Module, been suspended see: https://github.com/RediSearch/RediSearch/
C
34
star
9

redablooms

Scalable, counting Bloom filters Redis Module
C
28
star
10

redis-state-machine

A persistent state machine for redis
Rust
22
star
11

password

Redis module for secure password storage
C
22
star
12

RLTest

Redis Labs Test Framework
Python
18
star
13

readies

Library cluster of common Redis Modules automation code
Python
18
star
14

RAMP

Redis Automatic Module Packaging
Python
14
star
15

RedisREST

REST module for Redis
Rust
13
star
16

graphicsmagick

Redis Module wrapping libGraphicsMagick
C
11
star
17

pam_auth

POC module for PAM-based AUTH command
C
9
star
18

redisbench-admin

Redis benchmark run helper
Python
7
star
19

RedisPythonModule

Redis Python Module
C
4
star
20

RedisX

Extension modules to Redis' native data types and commands
Python
4
star
21

rtexp

Real Time Expiration Module
C
3
star
22

arlecchino

Redis Labs Enterprise Cluster on Docker
Python
3
star
23

redisenv

A docker-based wrapping tool, for making redis environments
Python
3
star
24

redis-java-benchmarks

This folder contains scripts that produce reproducible timings of various jedis features, and to visualize what your java redis code is spending time without modifying the code in any way. It attempts to avoid falling victim to undesirable optimizations by offering BlackHoles and a solid collection of conventions by using JMH.
Java
3
star
25

similar-images

Python
3
star
26

predis-magento-cache

PHP
2
star
27

automata

Python
2
star
28

licenses

Redis Labs modules licenses
1
star
29

RedisSchema

Rust
1
star
30

ramp_analyzer

tool to analyze and modify ramp file
Python
1
star
31

testing-infrastructure

This repo aims to provide severall testing golden images and setups, to ensure the minimum requirements and toolset to be present.
HCL
1
star
32

cloud-native-benchmarks

DBMS cloud native benchmarks, broken down by database model
Python
1
star
33

redisplus-py

All-in-one module playground.
Python
1
star
34

node-redis-modules

1
star
35

etc-structor

Accompanying payload for structor-aided versioned documentation
Dockerfile
1
star