newCache method

Cache newCache(
  1. T store, {
  2. String? name,
  3. ExpiryPolicy? expiryPolicy,
  4. KeySampler? sampler,
  5. EvictionPolicy? evictionPolicy,
  6. int? maxEntries,
  7. CacheLoader? cacheLoader,
  8. Clock? clock,
})

Creates a new cache

  • store: The CacheStore
  • name: The name of the cache
  • expiryPolicy: The expiry policy to use
  • sampler: The sampler to use upon eviction of a cache element
  • evictionPolicy: The eviction policy to use
  • maxEntries: The max number of entries this cache can hold if provided.
  • cacheLoader: The CacheLoader, that should be used to fetch a new value upon expiration
  • clock: The source of time to be used on this

Implementation

Cache newCache(T store,
    {String? name,
    ExpiryPolicy? expiryPolicy,
    KeySampler? sampler,
    EvictionPolicy? evictionPolicy,
    int? maxEntries,
    CacheLoader? cacheLoader,
    Clock? clock}) {
  return newDefaultCache(store,
      name: name,
      expiryPolicy: expiryPolicy,
      sampler: sampler,
      evictionPolicy: evictionPolicy,
      maxEntries: maxEntries,
      cacheLoader: cacheLoader,
      clock: clock);
}