newSembastFileCache function
Cache
newSembastFileCache({
- String? path,
- String? cacheName,
- KeySampler? sampler,
- EvictionPolicy? evictionPolicy,
- int? maxEntries,
- ExpiryPolicy? expiryPolicy,
- CacheLoader? cacheLoader,
- EventListenerMode? eventListenerMode,
- CacheStore? store,
- dynamic fromEncodable(
- dynamic
- int? databaseVersion,
- OnVersionChangedFunction? onVersionChanged,
- DatabaseMode? databaseMode,
- SembastCodec? sembastCodec,
Creates a new Cache
backed by a SembastStore
path
: The location of this store, if not provided defaults to "stash_sembast.db"cacheName
: 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, note thatfromEncodable
,databaseVersion
,onVersionChanged
,databaseMode
andsembastCodec
will be all ignored is this parameter is providedfromEncodable
: A custom function the converts to the object from aMap<String, dynamic>
representationdatabaseVersion
: The expected versiononVersionChanged
: IfdatabaseVersion
not null and if the existing version is different, onVersionChanged is calleddatabaseMode
: The database modesembastCodec
: The codec which can be used to load/save a record, allowing for user encryption
Returns a new Cache
backed by a SembastStore
Implementation
Cache newSembastFileCache(
{String? path,
String? cacheName,
KeySampler? sampler,
EvictionPolicy? evictionPolicy,
int? maxEntries,
ExpiryPolicy? expiryPolicy,
CacheLoader? cacheLoader,
EventListenerMode? eventListenerMode,
CacheStore? store,
dynamic Function(dynamic)? fromEncodable,
int? databaseVersion,
OnVersionChangedFunction? onVersionChanged,
DatabaseMode? databaseMode,
SembastCodec? sembastCodec}) {
return newSembastCache(
newSembastFileStore(
path: path,
fromEncodable: fromEncodable,
databaseVersion: databaseVersion,
onVersionChanged: onVersionChanged,
databaseMode: databaseMode,
sembastCodec: sembastCodec),
cacheName: cacheName,
sampler: sampler,
evictionPolicy: evictionPolicy,
maxEntries: maxEntries,
expiryPolicy: expiryPolicy,
cacheLoader: cacheLoader,
eventListenerMode: eventListenerMode);
}