#[cfg(test)] mod tests { use json::object; use df_helper::{cache, datetime, files}; #[test] fn post() { let cache_conf = files::file::file_content_get_json("tests/config/cache.json"); let mut cache = cache::cache::Cache::connect(cache_conf); let data = object! { name:1213, cont:"123123" }; let ttt = cache.db(1).set("33", data.into(), 1); println!("{}", ttt); datetime::timer::Timer::sleep(1000); let ttt = cache.db(1).get("33"); println!("{:#}", ttt); let ttt = cache.db(1).del("33"); println!("{}", ttt); } #[test] fn list() { let cache_conf = files::file::file_content_get_json("tests/config/cache.json"); let mut cache = cache::cache::Cache::connect(cache_conf); let data = object! { name:1213, cont:"123123" }; let ttt = cache.db(1).set_list("33", data.into()); println!("{}", ttt); let data = object! { name:2143414, cont:"1234534533123" }; let ttt = cache.db(1).set_list("33", data.into()); println!("{}", ttt); let ttt = cache.db(1).get_list("33"); println!("{:#}", ttt); let ttt = cache.db(1).del("33"); println!("{}", ttt); } #[test] fn set_message_queue() { let cache_conf = files::file::file_content_get_json("tests/config/cache.json"); let mut cache = cache::cache::Cache::connect(cache_conf); let data = object! { name:1213, cont:"123123" }; let ttt = cache.db(1).set_message_queue("33", data.into()); println!("{:#}", ttt); let ttt = cache.db(1).get_message_queue("33"); println!("{:#}", ttt); } }