purgeByBoundary method
Purges the cache whose Tiles intersects with the given boundingBox
. Any bitmap which is fully or partially intersecting the
given boundingBox
will be purged.
Implementation
@override
Future<void> purgeByBoundary(BoundingBox boundingBox) async {
// todo find a method to remove only affected files. For now we clear the whole cache
int count = 0;
for (String file in []..addAll(_files)) {
//_log.info(" purging file from cache: $file");
try {
bool ok = await FileHelper.delete(file);
if (ok) ++count;
} catch (error) {
_log.warning("purging $file was not successful, ignoring");
}
}
_log.info("purged $count files from cache $renderkey");
_files.clear();
}