createEntry method
Creates or overwrites an entry in the cache.
Returns an ICacheEntry for chaining. The entry is not added to the cache until it is disposed.
Example:
final entry = cache.createEntry('key')
..value = 'value'
..absoluteExpirationRelativeToNow = Duration(minutes: 5);
// Entry is added when the entry would naturally be disposed,
// or you can manually commit it by calling a method that uses it
Implementation
@override
ICacheEntry createEntry(Object key) {
// Remove existing entry if present
if (_entries.containsKey(key)) {
removeEntry(key, EvictionReason.replaced);
}
final entry = CacheEntryInternal(
key,
removeEntry,
finalizeEntry,
);
// Add to cache immediately - finalization happens later via finalizeEntry
_entries[key] = entry;
return entry;
}