1use std::{fs, thread};
2use std::path::{PathBuf};
3use std::time::Duration;
4use df_cache::Cache;
5
6fn main() {
7 let dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
8 let dir = dir.join("config");
9 let config_path = dir.join("cache.json");
10
11 let conf = fs::read_to_string(config_path.to_str().unwrap()).unwrap();
12 let conf = json::parse(conf.as_str().clone()).unwrap();
13 let mut cache = Cache::connect(conf);
14 let data = cache.db(0).set("t", "1".into(), 2);
20 println!(">>>{}", data);
21 thread::sleep(Duration::from_secs(1));
22 let data = cache.db(0).get("t");
23 println!(">>>{}", data);
24}