Cached Tile Source
Cache-first decorator over a TileSource. The lookup order is:
Read store. Hit → return cached blob (no network); if the blob is older than the store's eviction CachePolicy.staleAfter, also kick a background refresh (stale-while-revalidate — see maybeRevalidate).
Miss → fetch from inner (network), write-through to store, return.
When inner is null, this acts as a pure cache view — useful for replaying a GPKG file offline (e.g. opened in QGIS-style "browse cached layers" mode). A network failure with no cached blob propagates as null from fetchTile.
Cache hits bypass previousEtag / previousLastModified entirely — the cached blob is served verbatim. Pass those revalidation headers in only when you want the inner source to issue a conditional GET, which the decorator only does on a miss.
Properties
Delegates to the underlying store when it reports a CachedSourceInfo; null when the store isn't cache-introspectable (custom in-memory store, etc.).
When true, fetchTile never calls inner — cache hits are served as usual, cache misses return null. Equivalent to constructing with inner = null, but toggleable at runtime so a single layer can flip between online and offline modes without re-wiring its tile factory.
The wrapped upstream tile source (e.g. WmsTileSource, WmtsTileSource, UrlTemplateImageTileSource). Exposed for rebind flows — attachCache extractors peel this off when the layer is already cache-attached and being rebound to a different content manager. null for offline-only caches.
Invoked (off the render thread) after a stale tile is re-downloaded and written through, so the render layer can drop the tile's cached texture and redraw. null = no swap; the fresh tile then appears on the next texture (re)load.
Functions
Bulk-download semantics: by default skip already-cached tiles, otherwise force a network fetch and write through to store. Unlike fetchTile, this bypasses isCacheOnly — bulk is a user-initiated "fetch these bytes now" operation orthogonal to the renderer's offline toggle. Returns the blob (cached or freshly fetched), or null when there's no cached tile and no network source / network fetch failed.
Download every tile that intersects sector across every level whose resolution falls in resolution — typically used by "save a region for offline use" flows. Returns the launched Job so the caller can cancel mid-download.
Pause stale-while-revalidate for the lifetime of job (a bulk region download using this source). SWR resumes automatically when the job completes or is cancelled.
Cache-only fast-path read for (z, x, y). Default returns null — a plain network source has no cache to consult. Cache-backed sources override to read their store without going through the network-fetch concurrency budget.