@classmethod
    def shave_cache(cls, filename, bbox):
        x1, y1, x2, y2 = bbox
        conn = db.connect(filename)
        c = conn.cursor()
        c.execute('select min(zoom_level) from map')
        c.execute('select max(zoom_level) from map')
        min_zoom = c.fetchone()
        max_zoom = c.fetchone()

        if min_zoom:
            min_zoom = min_zoom[0]
        else:
            min_zoom = 0
        if max_zoom:
            max_zoom = max_zoom[0]
        else:
            max_zoom = 32

        c.close()

        c = conn.cursor()

        del_map_entry = """
        DELETE FROM map WHERE
            tile_column >= ? AND
            tile_row >= ? AND
            tile_column <= ? AND
            tile_row <= ? AND
            zoom_level = ?
        """

        del_tile_data = """
        DELETE FROM images
        WHERE tile_id IN (
            SELECT tile_id
            FROM map WHERE
                tile_column >= ? AND
                tile_row >= ? AND
                tile_column <= ? AND
                tile_row <= ? AND
                zoom_level = ?
        )
        """
        e4326 = osr.SpatialReference()
        e3857 = osr.SpatialReference()
        e4326.ImportFromEPSG(4326)
        e3857.ImportFromEPSG(900913)
        crx = osr.CoordinateTransformation(e3857, e4326)
        x1, y1, _ = crx.TransformPoint(x1, y1)
        x2, y2, _ = crx.TransformPoint(x2, y2)

        for zoom in range(min_zoom, max_zoom+1):
            a1, b1 = deg2num(y1, x1, zoom)
            a2, b2 = deg2num(y2, x2, zoom)
            print 'deleting tiles from {a1},{b1} - {a2},{b2} for {zoom}'.format(**locals())
            c.execute(del_tile_data, [a1, b1, a2, b2, zoom])
            c.execute(del_map_entry, [a1, b1, a2, b2, zoom])

        c.execute('ANALYZE')
        c.execute('VACUUM')

        conn.commit()
        conn.close()
Empties a bounding box out of the cache at all zoom levels to be regenerated on demand.  For supporting
dataset/ETHPy150Open hydroshare/hydroshare2/ga_resources/drivers/__init__.py/MBTileCache.shave_cache