rusticache

Crates.iorusticache
lib.rsrusticache
version0.1.0
sourcesrc
created_at2022-09-03 14:50:29.937086
updated_at2022-09-09 15:06:10.75938
descriptionSimple caching for rust without external requirements.
homepagehttps://github.com/bleikurr/rusticache
repositoryhttps://github.com/bleikurr/rusticache
max_upload_size
id657917
size13,223
Frosti Grétarsson (bleikurr)

documentation

README

rusticache

Cache library to be used in async or singlethreaded(not implemented) context.

Simple usage:

use std::sync::Arc;
use rusticache::AsyncCache;
use std::time::Duration;

async fn do_stuff() {
    let cache = Arc::new(AsyncCache::new(
        Duration::from_secs(10),
        Box::new(|| Ok(String::from("This is Sparta!")))
    ));

    let data = cache.get_data().await;
    assert_eq!(*data.unwrap(), String::from("This is Sparta!"));
}
do_stuff();
Commit count: 6

cargo fmt