removeByHash static method
Remove metadata by URL hash. Used by LRU cache eviction when the original URL is not known.
Implementation
static Future<void> removeByHash(String hash) async {
await _ensureLoaded();
// Find and remove entries whose URL hashes to the given hash
final urlsToRemove = <String>[];
for (final url in _cache.keys) {
// Simple check - if the URL hash matches, remove it
// We import differently to avoid circular dependency
if (_hashesMatch(url, hash)) {
urlsToRemove.add(url);
}
}
for (final url in urlsToRemove) {
_cache.remove(url);
}
if (urlsToRemove.isNotEmpty) {
await _persist();
}
}