newDefaultCache<T extends CacheStore> function Null safety

Cache newDefaultCache<T extends CacheStore>(
  1. T store,
  2. {String? name,
  3. ExpiryPolicy? expiryPolicy,
  4. KeySampler? sampler,
  5. EvictionPolicy? evictionPolicy,
  6. int? maxEntries,
  7. CacheLoader? cacheLoader,
  8. Clock? clock,
  9. EventListenerMode? eventListenerMode}

Creates a new DefaultCache bound to an implementation of the CacheStore interface

  • store: The store implementation
  • 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
  • eventListenerMode: The event listener mode of this cache


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