#cache #async

yanked rusticache

Simple caching for rust without external requirements

0.1.0 Sep 9, 2022
0.0.3 Sep 6, 2022
0.0.2 Sep 5, 2022
0.0.1 Sep 3, 2022

#224 in #asynchronous

MIT/Apache

13KB
202 lines

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();

lib.rs:

DOCUMENTATION NOT FINISHED

Dependencies

~2–7.5MB
~47K SLoC