newEntry function
CacheEntry
newEntry(})
Creates a new CacheEntry
with the provided ValueGenerator and seed
generator
: The ValueGenerator to useseed
: The seed for the ValueGeneratorkey
: The cache keyexpiryTime
: The cache expiry timecreationTime
: The cache creation timeaccessTime
: The cache accessTimeupdateTime
: The cache update timehitCount
: The cache hit count
Returns a fully initialized CacheEntry
Implementation
CacheEntry newEntry(ValueGenerator generator, int seed,
{String? key,
DateTime? expiryTime,
DateTime? creationTime,
DateTime? accessTime,
DateTime? updateTime,
int? hitCount}) {
return CacheEntry(key ?? 'cache_key_$seed', generator.nextValue(seed),
expiryTime ?? seed.minutes.fromNow, creationTime ?? DateTime.now(),
accessTime: accessTime, updateTime: updateTime, hitCount: hitCount);
}