checkPurgedEntriesTimeout method
void
checkPurgedEntriesTimeout()
Remove expired purged entries. Only relevant if purgedEntriesTimeout is not null.
Implementation
void checkPurgedEntriesTimeout() {
var purged = _purged;
var purgedEntriesTimeout = this.purgedEntriesTimeout;
if (purged != null &&
purgedEntriesTimeout != null &&
purgedEntriesTimeout.inMilliseconds > 0) {
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(growable: false);
if (expired.isNotEmpty) {
for (var k in expired) {
purged.remove(k);
}
_expireCache();
}
}
}