revalidatePurgedEntries method

int revalidatePurgedEntries()

Restore purged entries that are currently valid. Only relevant if keepPurgedEntries is true.

Implementation

int revalidatePurgedEntries() {
  if (_purged != null) {
    var purged = _purged!;
    var validPurged = purged.entries
        .where((e) => isValidEntry(e.key, e.value.value))
        .toList();

    if (validPurged.isNotEmpty) {
      for (var e in validPurged) {
        _map[e.key] = e.value.value;
        purged.remove(e.key);
      }
      _expireCache();
    }

    _revalidatedPurgedEntriesCount += validPurged.length;
    return validPurged.length;
  }
  return 0;
}