r2d2-memcache

Build Status Latest Version Docs

Install

Add this to your Cargo.toml:

[dependencies]
r2d2-memcache = "0.2.0"

Basic Usage

extern crate r2d2_memcache;

fn main() {
    let manager = r2d2_memcache::MemcacheConnectionManager::new("memcache://localhost:11211");
    let pool = r2d2_memcache::r2d2::Pool::builder().max_size(15).build(manager).unwrap();

    let mut conn = pool.get().unwrap();
    conn.flush().unwrap();
    let value = "bar";
    conn.set("foo_get", value, 10).unwrap();
    let result: String = conn.get("foo_get").unwrap().unwrap();
    assert!(result == "bar");
}

License