Our "traffic management" app shows thousands of roads on a Google Maps basemap.
We use CARTO Dynamic Tiling to produce map vector tiles in real-time, via SQL queries to our BigQuery backend.
The vector tiles are then rendered on the Google Maps basemap using a deck.gl CartoLayer
.
It works beautifully, though we've noticed that the vector tiles are "stale", i.e. they do not reflect yesterday's updates to our BigQuery data. The tiles appear to be cached by the CARTO tiler, but I can see no way of modifying its behaviour.
If I'm understanding this blog correctly:
Data resulting from applying SQL queries to your data sources are considered point-in-time extractions and cached for a year.
A year?!
My question: How do I clear the cache for a CARTO Dynamic Tiling connection?
Are you using a CartoLayer
right? Depending on want you want to achieve:
1 - You want to invalidate or obtain a fresh answer from the backend:
new CartoLayer({
...
headers: {
'Cache-Control': 'no-cache'
}
})
2 - I want to re-create data (tiles) associated to a table, update 1 time each 10 minutes:
new CartoLayer({
...
headers: {
// The map should be re-instantiated every 10 minutes with:
'Cache-Control': 'max-age=600'
}
})
Also see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control