MapAsCacheExtension<K, V> extension

Extension that ads cached methods to a Map.

on

Methods

checkCachedEntry(K key) → void
checkCacheLimit(int? cacheLimit) int
Checks if this Map.length is bigger than cacheLimit and removes elements to not exceed the cacheLimit.
getCached(K key, V computer(), {int? cacheLimit}) → V
Returns key value or computes it and caches it. See checkCachedEntry, checkCacheLimit and getCachedAsync.
getCachedAsync(K key, FutureOr<V> computer(), {int? cacheLimit}) FutureOr<V>
Same as getCached but accepts a computer that returns a Future. See checkCachedEntry, checkCacheLimit and getCachedAsync.
getCachedAsyncNullable(K key, FutureOr<V?> computer(), {int? cacheLimit}) FutureOr<V?>
getCachedNullable(K key, V? computer(), {int? cacheLimit}) → V?
getIfCached(K key, {int? cacheLimit}) → V?
Returns key value, checking if it's still valid. See checkCachedEntry and checkCacheLimit.