hydracache 0.52.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_infallible, HydraCache};
use serde::{Deserialize, Serialize};

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

fn main() {
    let cache = HydraCache::local().build();
    let _future = cacheable_infallible!(
        cache = cache,
        key = "value:1",
        tags = ["values", "value:1"],
        ttl_secs = 60,
        load = || async { Value { id: 1 } },
    );
}