Skip to main content

fetch

Function fetch 

Source
pub async fn fetch(
    store: &dyn CacheStore,
    key: &str,
    ttl_secs: Option<u64>,
    render: impl AsyncFnOnce() -> Value,
) -> Result<Value>
Expand description

Return the cached value for key, or compute it with render, store it (with optional ttl_secs), and return it. render runs only on a miss.