Cache<K, V>.expiry constructor
Cache<K, V>.expiry ({})
Constructs an expiry cache.
The loader
defines the function to construct items for the cache.
updateExpiry
is the maximal duration after which an updated item
exists. accessExpiry
is the maximal duration an item does not
expire without being accessed. Whatever happens last, causes the
expiration.
Note that cached items do not magically disappear when they expire. Manually call reap(), or setup a timer to regularly free items.
Implementation
factory Cache.expiry(
{required Loader<K, V> loader,
Duration? updateExpiry,
Duration? accessExpiry}) =>
ExpiryCache(loader, updateExpiry, accessExpiry);