cache method
Caches a value
with a given key
.
If cacheDuration
is set, the entry will automatically expire.
Implementation
void cache(String key, T value, {Duration? cacheDuration}) {
_cache[key] = _CachedItem(value, cacheDuration);
if (cacheDuration != null) {
_startExpiration(key, cacheDuration);
}
}