Module redis

Module redis 

Source
Expand description

This module contains the types that can be used with a Redis backend. Must be enabled by feature redis.

§Redis Types

This crate provides a set of types that can be stored in Redis. The types are:

This crate implements the most common traits for the primitive types, so it is frictionless to use them in place. The methods of the types can be seen in the documentation of Generic. With this crate it is possible to create multiple services that shares the values via Redis. This is helpful if you want to create a distributed system and run multiple instances of the same service. Or you want to communicate between different services. All this kind of stuff can be done with this crate.

§Upcoming Features

It will be possible to create happens-before relationships between store and load operations like atomic types. Also it will be possible to create other backends than Redis.

§Usage

use dtypes::redis::types::Di32 as i32;

let client = redis::Client::open("redis://localhost:6379").unwrap();
let mut i32 = i32::with_value(1, "test_add", client.clone());

i32 = i32 + i32::with_value(2, "test_add2", client.clone());
assert_eq!(i32, 3);

More examples can be found on the doc pages of the types.

§Custom Types

It is possible to implement your own complex types by implementing the BackedType trait. But it should not be needed as long as your type implements some or all of the various Ops traits.

Modules§

sync
types
Holds all the types that can be stored in Redis.