newMemoryCache function
Cache
newMemoryCache({
- String? cacheName,
- ExpiryPolicy? expiryPolicy,
- KeySampler? sampler,
- EvictionPolicy? evictionPolicy,
- int? maxEntries,
- CacheLoader? cacheLoader,
Creates a new Cache backed by a MemoryStore
cacheName: The name of the cacheexpiryPolicy: The expiry policy to use, defaults to EternalExpiryPolicy if not providedsampler: The sampler to use upon eviction of a cache element, defaults to FullSampler if not providedevictionPolicy: The eviction policy to use, defaults to LfuEvictionPolicy if not providedmaxEntries: The max number of entries this cache can hold if provided. To trigger the eviction policy this value should be providedcacheLoader: The CacheLoader that should be used to fetch a new value upon expiration
Returns a Cache backed by a MemoryStore
Implementation
Cache newMemoryCache(
{String? cacheName,
ExpiryPolicy? expiryPolicy,
KeySampler? sampler,
EvictionPolicy? evictionPolicy,
int? maxEntries,
CacheLoader? cacheLoader}) {
return Cache.newCache(MemoryStore(),
name: cacheName,
expiryPolicy: expiryPolicy,
sampler: sampler,
evictionPolicy: evictionPolicy,
maxEntries: maxEntries,
cacheLoader: cacheLoader);
}