beforeGet method
Process the entry found in the storage before returning it. If this method returns null the entry is considered as expired and will not be returned to the caller.
Implementation
@override
CacheEntry<K, V>? beforeGet(CacheEntry<K, V> entry) {
if ((entry as ExpirationCacheEntry).insertTime <
DateTime.now().millisecondsSinceEpoch - expiration.inMilliseconds) {
// do not call onCapacity because if the entry is expired we do not want to keep it anyway
storage.removeInternal(entry.key);
return null;
}
return entry;
}