storage-trait

A simple k-v pair storage trait, including the implementation of dashmap and redis.

Depending on this crate via cargo: rust [dependencies] storage-trait = "0.1.1"

Dashmap Support

You can build a dashmap storage object implmenting storage trait by using methods below: ```rust use storage_trait::{DashMapStorageBuilder, Storage};

fn setget() { let storage = DashMapStorageBuilder::new().build(); let _ = storage .set("name".tostring(), "Ferris".tostring()) .unwrap(); let resp = storage.get("name".tostring()).unwrap(); println!("resp: {:?}", resp); }

output: rust resp: Some("Ferris") ```

Redis Support(single node)

Build a redis storage object: ```rust use storage_trait::{RedisStorageBuilder, Storage};

fn setcontains() { let storage = RedisStorageBuilder::new() .addr("redis://127.0.0.1:6379") .build(); let _ = storage .set("name".tostring(), "Ferris".tostring()) .unwrap(); let resp = storage.contains("name".tostring()).unwrap(); println!("resp: {:?}", resp); } output: rust resp: true ```