checkPurgedEntriesTimeout method
void
checkPurgedEntriesTimeout()
Remove expired purged entries. Only relevant if purgedEntriesTimeout is not null.
Implementation
void checkPurgedEntriesTimeout() {
if (_purged != null &&
purgedEntriesTimeout != null &&
purgedEntriesTimeout!.inMilliseconds > 0) {
var purged = _purged!;
var timeoutMs = purgedEntriesTimeout!.inMilliseconds;
var now = DateTime.now().millisecondsSinceEpoch;
var expired = purged.entries
.where((e) => (now - e.value.key.millisecondsSinceEpoch) > timeoutMs)
.map((e) => e.key)
.toList();
if (expired.isNotEmpty) {
for (var k in expired) {
purged.remove(k);
}
_expireCache();
}
}
}