Skip to content

A Redis module implementing a MultiMap type

License

MIT, BSD-3-Clause licenses found

Licenses found

MIT
LICENSE
BSD-3-Clause
REDIS_LICENSE
Notifications You must be signed in to change notification settings

gsquire/redis-multi-map

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

redis-multi-map

Build Status

This crate provides a custom Redis module type using Rust's FFI support. By leveraging the ability to make custom types that Redis can utilize we can use Rust to provide a new data structure. The MultiMap type is akin to Redis' existing hash type with the added benefit of storing more than one value.

Production Readiness

I would not consider this module to be production ready at the moment. There should be more extensive unit test coverage.

Some benchmark numbers achieved by running the provided script locally:

MULTIMAP.INSERT averaged over 5 runs: 66,760 requests/s
SET averaged over 5 runs: 78,672 requests/s

Install

You must have Rust and LLVM installed in order to compile this project. The preferred way to install Rust is using the rustup tool. If you are wary of shell script installs, you can download it through brew.

brew install llvm # And `brew install rust` if you don't already have it installed.

git clone https://github.com/gsquire/redis-multi-map
cd redis-multi-map
cargo build --release # The dynamic library will be under the target/release folder.

Running Redis

You can load the module in a few ways.

Directly from the command line.

redis-server --loadmodule /path/to/module.dylib # Or /path/to/module.so on Unix systems.

Using the Redis configuration file

loadmodule /path/to/module.dylib

API

The API is open to extending if other functionality is desired. The currently supported commands are as follows:

Insert

MULTIMAP.INSERT KEY MAP_KEY MAP_VALUE...

This command returns a simple string of "OK".

Values

MULTIMAP.VALUES KEY MAP_KEY

This command lists all values associated with MAP_KEY. It is an array of strings.

Length

MULTIMAP.LEN KEY MAP_KEY

This command returns the length of values for MAP_KEY and 0 if it doesn't exist. This is an integer response.

Delete

MULTIMAP.DEL KEY MAP_KEY

This command deletes MAP_KEY from KEY. It is an integer response of 0 if MAP_KEY did not exist and 1 if it did.

Thanks

Thanks to redis-cell for providing some motivation and guidance in making another module using Rust.

License

This code is release under an MIT license and the Redis license stored under REDIS_LICENSE.

About

A Redis module implementing a MultiMap type

Topics

Resources

License

MIT, BSD-3-Clause licenses found

Licenses found

MIT
LICENSE
BSD-3-Clause
REDIS_LICENSE

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published