Whenever tilerator updates a tile, it should invalidate it in Varnish. Since we are currently generating about 1700 tiles per second (the whole cluster), this seems a bit excessive on Varnishes (@BBlack?). Also, generation a tile should invalidate the whole pyramid of tiles underneath it - otherwise lets say tile at z6 was generated, and it was partially (one quarter) over water - this means that out of the 4 tiles at the same location at z7, 3 might not be stored in cassandra at all (blank space), which means when users request z7, the system will use overzoom to take data from z6.
We could allow zoom level invalidation - anything that starts with /7/* gets invalidated.
Or, we could introduce "range invalidation", where we send the range of tiles (fromIndex, untilIndex). This requires varnish to do map-specific indexing -- internally all our tiles have an index 0 .. (4^zoom-1) for a given zoom level. We could expose this indexing, and let varnish do the [x,y] coordinate conversion into an index (simple bit manipulation). Thus, all internal requests would become /zoom/index.png, and if varnish can treat that index as an integer, purging is simple. Or we could pad the index string with zeroes, and let varnish do purging based on the string comparison - [from <= index < until].