hydracache 0.28.0

User-facing HydraCache runtime crate.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use hydracache::{cacheable, HydraCache};
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize)]
struct Value {
    id: u64,
}

fn main() {
    let cache = HydraCache::local().build();
    let _future = cacheable!(
        cache = cache,
        key = "value:1",
        tag = "values",
        ttl_secs = 60,
        load = || async { Ok::<_, std::io::Error>(Value { id: 1 }) },
    );
}