newMemoryCacheInterceptor function
Interceptor
newMemoryCacheInterceptor(})
Creates a new Interceptor
backed by a Cache
with MemoryStore
storage
pattern
: All the calls with a url matching this pattern will be cachedcacheName
: The name of the cachesampler
: The sampler to use upon eviction of a cache element, defaults toFullSampler
if not providedevictionPolicy
: The eviction policy to use, defaults toLfuEvictionPolicy
if not providedmaxEntries
: The max number of entries this cache can hold if provided. To trigger the eviction policy this value should be providedexpiryPolicy
: The expiry policy to use, defaults toEternalExpiryPolicy
if not providedcacheLoader
: TheCacheLoader
that should be used to fetch a new value upon expirationeventListenerMode
: The event listener mode of this cachestore
: An existing store
Returns a Interceptor
Implementation
Interceptor newMemoryCacheInterceptor(String pattern, String cacheName,
{KeySampler? sampler,
EvictionPolicy? evictionPolicy,
int? maxEntries,
ExpiryPolicy? expiryPolicy,
CacheLoader? cacheLoader,
EventListenerMode? eventListenerMode,
MemoryStore? store}) {
return newCacheInterceptor(
pattern,
newMemoryCache(
cacheName: cacheName,
evictionPolicy: evictionPolicy,
sampler: sampler,
expiryPolicy: expiryPolicy,
maxEntries: maxEntries,
cacheLoader: cacheLoader,
eventListenerMode: eventListenerMode,
store: store));
}