Goal
Tile responses currently set Cache-Control: max-age=3600 but every request re-runs the ST_AsMVT query. On large collections (millions of features) this is the dominant cost. A persistent server-side cache would dramatically reduce CPU and DB load.
Scope
- Cache key:
{collection_id}/{z}/{x}/{y}.pbf
- First implementation: filesystem under a configurable
CACHE_DIR (env var or sanson_config entry)
- Interface designed so a Redis or S3 backend can replace the filesystem later without touching the route code
- TTL configurable (reuse
tiles.cache_ttl_seconds from sanson_config)
Invalidation
- Re-import of a collection drops the data table — must also drop the cached tiles for that collection
- Collection deletion drops the cache for that collection
- Style update does NOT invalidate (style is applied client-side via the
/collections/{id}/style endpoint)
Acceptance criteria
Out of scope
- Distributed cache backends (Redis, S3) — keep the interface ready
- Pre-warming / cache priming
- Per-collection TTL overrides
Goal
Tile responses currently set
Cache-Control: max-age=3600but every request re-runs theST_AsMVTquery. On large collections (millions of features) this is the dominant cost. A persistent server-side cache would dramatically reduce CPU and DB load.Scope
{collection_id}/{z}/{x}/{y}.pbfCACHE_DIR(env var orsanson_configentry)tiles.cache_ttl_secondsfromsanson_config)Invalidation
/collections/{id}/styleendpoint)Acceptance criteria
TileCacheinterface with a filesystem implementation/api/admin/healthdocs/api/vector-tiles.md+ CLAUDE.md "Key architectural decisions"Out of scope