cached 3.1.0

Generic cache implementations and simplified function memoization
Documentation
1
2
3
4
5
6
7
8
9
10
use cached::macros::concurrent_cached;

// map_error is passed to Result::map_err, so an async closure must be rejected
// at the macro with a pointed message rather than failing the FnOnce bound.
#[concurrent_cached(disk = true, ttl_secs = 60, map_error = async |e| format!("{e:?}"))]
async fn my_fn(k: u32) -> Result<u32, String> {
    Ok(k)
}

fn main() {}