purgeByBoundary method

  1. @override
void purgeByBoundary(
  1. BoundingBox boundingBox
)

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
void purgeByBoundary(BoundingBox boundingBox) {
  // Ultra-fast boundary-based purging using spatial index
  // This provides O(log n) performance instead of O(n) iteration
  final Set<Tile> tilesToRemove = _spatialIndex.getTilesInBoundary(boundingBox);

  // Batch removal to minimize cache operations
  for (final Tile tile in tilesToRemove) {
    _cache.remove(tile);
    _spatialIndex.removeTile(tile);
  }
}