pub async fn cached_render<F, Fut>(
cache: &(dyn Cache + 'static),
key: &str,
ttl: Option<Duration>,
compute: F,
) -> StringExpand description
Return the cached fragment for key, or compute and store it.
compute runs only on a miss or a cache error. Pass the result to
your template as a variable, such as {{ sidebar_html | safe }}.
ttl follows Cache::set: None stores with no expiry.
A cache error is logged and treated as a miss, so the caller always gets a value.