newLazyHiveCache function
Cache
newLazyHiveCache(})
Creates a new Cache
backed by a HiveLazyStore
path
: The base storage location for this cachecacheName
: The name of the cacheexpiryPolicy
: The expiry policy to use, defaults toEternalExpiryPolicy
if not providedsampler
: 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 providedcacheLoader
: TheCacheLoader
that should be used to fetch a new value upon expirationfromEncodable
: A custom function the converts to the object from aMap<String, dynamic>
representation
Returns a new Cache
backed by a HiveLazyStore
Implementation
Cache newLazyHiveCache(String path,
{String? cacheName,
ExpiryPolicy? expiryPolicy,
KeySampler? sampler,
EvictionPolicy? evictionPolicy,
int? maxEntries,
CacheLoader? cacheLoader,
dynamic Function(dynamic)? fromEncodable,
HiveCipher? encryptionCipher,
bool? crashRecovery}) {
return Cache.newCache(
HiveLazyStore(
HiveLazyAdapter(path,
encryptionCipher: encryptionCipher, crashRecovery: crashRecovery),
fromEncodable: fromEncodable),
name: cacheName,
expiryPolicy: expiryPolicy,
sampler: sampler,
evictionPolicy: evictionPolicy,
maxEntries: maxEntries,
cacheLoader: cacheLoader);
}