Skip to main content

cached

Function cached 

Source
pub async fn cached<F, Fut>(fs: &Fs, url: &Url, fetch: F) -> Option<String>
where F: FnOnce() -> Fut, Fut: Future<Output = Option<String>>,
Expand description

Content for the cache entry at url, fetching it with fetch when the entry is missing or older than CACHE_TTL.

A successful fetch is written back to the cache. A failed fetch falls back to the stale entry, if any.