Crates.io | r2d2-memcache |
lib.rs | r2d2-memcache |
version | 0.6.0 |
source | src |
created_at | 2017-01-18 02:16:23.141135 |
updated_at | 2021-01-07 14:53:12.63247 |
description | Memcached support for the r2d2 connection pool |
homepage | |
repository | https://github.com/megumish/r2d2-memcache |
max_upload_size | |
id | 8112 |
size | 3,304,713 |
Add this to your Cargo.toml
:
[dependencies]
r2d2-memcache = "0.2.0"
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");
}