Skip to main content

remember

Function remember 

Source
pub async fn remember<S: CacheStore, T, F, Fut>(
    store: &S,
    key: &str,
    ttl: Duration,
    factory: F,
) -> CacheResult<T>
where T: Serialize + DeserializeOwned, F: FnOnce() -> Fut, Fut: Future<Output = CacheResult<T>>,
Expand description

Remember a value for a given duration.

If the key exists, returns the cached value. If not, calls the factory function, caches the result, and returns it.