MapAsCacheExtension<K, V> extension

Extension that ads cached methods to a Map.

on

Methods

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 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 checkCacheLimit and getCachedAsync.
getCachedAsyncNullable(K key, FutureOr<V?> computer(), {int? cacheLimit}) FutureOr<V?>
getCachedNullable(K key, V? computer(), {int? cacheLimit}) → V?