RedisCBOR is a Redis module that implements CBOR as a native data type. It allows storing, updating and fetching CBOR documents from Redis keys (documents).
It is based on RedisJson for its concepts, its commands and their syntax.
Benefits of CBOR over JSON:
- ~25% smaller memory footprint / bandwidth, depending on which type are used (text will have the same footprint in JSON or CBOR)
- integer, floats, boolean and null types should be faster to deserialize because they are encoded in binary, consequently there is no parsing from text to process.
- Full support of the CBOR standard
- CBORPath syntax for selecting elements inside documents
- Documents are stored as raw CBOR binary data, allowing reduced memory footprint
- Typed atomic operations for all CBOR types
Run the following on the main directory:
docker build -t redis-cbor .
Make sure you have Rust installed: https://www.rust-lang.org/tools/install
Run the following on the main directory:
cargo build --release
When running the tests, you need to explicitly specify the test feature to disable use of the Redis memory allocator when testing:
cargo test --features test
run the built image:
docker run --name redis-cbor -d -p 6379:6379 redis-cbor
Run Redis pointing to the newly built module:
redis-server --loadmodule ./target/release/librecbor.so
Alternatively add the following to a redis.conf file:
loadmodule /path/to/modules/librecbor.so
Read the docs here