clearBucket method
Implementation
@override
Future<void> clearBucket(String appId, MiniProgramCacheBucket bucket) async {
final normalizedAppId = MiniProgramCacheManager.namespacedKey(
appId: appId,
bucket: bucket,
key: '_probe',
).split('/')[1];
_entries.removeWhere(
(_, entry) => entry.appId == normalizedAppId && entry.bucket == bucket,
);
if (!await _directory.exists()) {
return;
}
for (final file in await _entryFiles()) {
final entry = await _readEntry(file);
if (entry == null) {
await _safeDelete(file);
continue;
}
if (entry.appId == normalizedAppId && entry.bucket == bucket) {
_entries.remove(entry.namespacedKey);
await _safeDelete(file);
}
}
}