Cache<K, V>.lru constructor

Cache<K, V>.lru({
  1. required Loader<K, V> loader,
  2. int maximumSize = 100,
})

Constructs a Least Recently Used (LRU) cache.

The loader defines the function to construct items for the cache; and maximumSize defines the maximum number of items cached.

Implementation

factory Cache.lru({required Loader<K, V> loader, int maximumSize = 100}) =>
    LruCache<K, V>(loader, maximumSize);