get_or_set
Get the entry associated with the given cache key if it exists, or insert and return the specified entry.
If the value is costly to compute, consider using get_or_set_with() instead to avoid
computation in the case where the value is already present.
let value = get_or_set("my_key", "hello!", Duration::from_secs(60))?;let cached_string = value.into_string();println!("the cached string was: {cached_string}");Argument type conversions
See the From impls for Bytes and Body to see which types
can be used as a key or a body, respectively.
Parameters
Returns
Result<crate::Body, CacheError>