You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(mbtiles)!: add a fetched timestamp to both cache layouts
Both cache schemas gain a `fetched INTEGER` column (Unix-epoch seconds,
right before `expires`) recording when the tile was downloaded/added/
last refreshed - the input for HTTP Age computation and staleness
heuristics.
- CacheEntryMeta/CachedTile gain a `fetched` field (before `expires`);
CacheEntryMeta::new is now (fetched, expires, etag).
- update_cached_meta bumps it on 304 revalidation along with
expires/etag.
- Cache-to-cache copies (any layout direction) preserve it; bulk copies
from non-cache sources leave it NULL rather than stamping copy time,
keeping identical copy runs byte-identical (existing CLI golden
outputs did not change).
- Schema detection now expects the six shared columns + one layout
column.
BREAKING CHANGE: cache schema DDL and `CacheEntryMeta::new` signature
changed.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/content/mbtiles-schema.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -68,9 +68,9 @@ In our next semver major, we plan to switch this default and produce `tiles_shal
68
68
69
69
## cache
70
70
71
-
The `cache` schemas store extra cache metadata (`expires` and `etag`) alongside each tile, so a file can serve as a persistent web-tile cache.
71
+
The `cache` schemas store extra cache metadata alongside each tile - `fetched` (when the tile was downloaded/added/last refreshed), `expires`, and `etag` - so a file can serve as a persistent web-tile cache.
72
72
Two layouts exist, mirroring the `flat` vs `normalized` split of the regular schemas.
73
-
Both center on a `tile_cache` table holding the tile Z,X,Y coordinates and the cache metadata, and both create a spec-compatible `tiles` view so the file can still be read by any standard MBTiles reader (the `expires`/`etag` columns are simply invisible to it).
73
+
Both center on a `tile_cache` table holding the tile Z,X,Y coordinates and the cache metadata, and both create a spec-compatible `tiles` view so the file can still be read by any standard MBTiles reader (the extra columns are simply invisible to it).
74
74
75
75
### cache-flat
76
76
@@ -95,8 +95,8 @@ This is the recommended default for web-tile caches, where identical (e.g. empty
95
95
The `mbtiles` tool treats both cache layouts as first-class schemas, with a few deliberate restrictions:
96
96
97
97
*`summary`, `validate`, `meta-*`, and serving the file with `martin` all work.
98
-
*`copy`**from** a cache file to any schema works (reading via the `tiles` view); the per-tile `expires`/`etag` values are dropped, since standard schemas cannot store them.
99
-
*`copy`**into** a cache file works from any schema (including `martin-cp --mbtiles-type cache-flat|cache-normalized`); the copied entries get `NULL``expires`/`etag` (never expire). Copies between cache files - including across the two layouts - preserve `expires`/`etag`.
98
+
*`copy`**from** a cache file to any schema works (reading via the `tiles` view); the per-tile `fetched`/`expires`/`etag` values are dropped, since standard schemas cannot store them.
99
+
*`copy`**into** a cache file works from any schema (including `martin-cp --mbtiles-type cache-flat|cache-normalized`); the copied entries get `NULL``fetched`/`expires`/`etag` (unknown fetch time, never expire; identical copy runs stay byte-identical). Copies between cache files - including across the two layouts - preserve all cache metadata.
100
100
*`diff`, `apply-patch`, and bin-diff **into or onto** a cache file are rejected: the `NOT NULL` blob storage joined through the `tiles` view cannot represent the `NULL` "deleted tile" markers a diff needs. A cache file *can* be the compared-against or patch-source side (it is read through the view).
101
101
*`cache-purge <file> [--max-size <MB>]` removes expired entries (and optionally evicts soonest-expiring entries until the file fits the size budget), then reclaims free pages via `PRAGMA incremental_vacuum`.
0 commit comments