AlfredCache<T> constructor
AlfredCache<T> ({})
Builds an AlfredCache providing a Cache backed by a Store
fromEncodable: A custom function the converts to the object from aMap<String, dynamic>representationpath: Optionally customize the base storage location for this storemaxEntries: The max number of entries this cache can hold if provided. Defaults to 10.name: The name of the cache. Defaults to "query_cache".evictionPolicy: Optionally customize theEvictionPolicy. Defaults toLruEvictionPolicyexpiryPolicy: Optionally customize theExpiryPolicy. Defaults toCreatedExpiryPolicywith a Duration of 1 minute.verbose: If set to true then listeners will print events to the developer log. Defaults to false.
Implementation
AlfredCache({
required this.fromEncodable,
this.path,
this.maxEntries = 10,
this.name = 'query_cache',
this.evictionPolicy = const LruEvictionPolicy(),
this.expiryPolicy = const CreatedExpiryPolicy(Duration(minutes: 1)),
this.verbose = false,
}) : assert(maxEntries > 0, 'maxEntries must be positive number');