Learn

What Is Map Caching?

Map caching stores reusable map responses or generated artifacts so repeated views can be served without regenerating or retransferring the same work each time.

Geobble
intermediateexplainerWeb Maps Tiles & Performance

Explain browser, CDN, tile and server-side caching in web maps, including cache keys, invalidation, versioning and the difference between caching and authoritative storage.

What Is Map Caching?

Map caching stores a reusable result so the same map request does not need to be generated from scratch every time.

The cached object might be a tile, an image, a vector response, a style resource or another publication artifact. Caching can reduce server work, lower latency and make repeated map views feel much faster.

Tiles are naturally cacheable

A tile with a stable address such as z/x/y represents a known part of a tileset.

If many users request the same tile, a browser, content-delivery network or server cache can reuse the existing response rather than regenerate it for every request.

This is one reason tile-based delivery scales well for popular public maps.

Caching can happen at several layers

A web-map request can benefit from:

  • browser cache — reuses resources already fetched by one user;

  • CDN or edge cache — serves common resources close to many users;

  • application cache — stores computed responses inside the service;

  • pre-generated tile cache — stores map tiles created before users request them.

These layers solve related but different problems.

A cache key decides what counts as the same request

A cache needs a stable identity for the response.

For a tile, the key may include zoom, row, column, style version and data version. If the style or underlying dataset changes but the key does not, users can receive stale content.

This is why versioning matters.

Changing a resource URL or version identifier when the content changes is often safer than trying to purge every copy immediately across multiple cache layers.

Invalidation is the hard part

Caching is easy when data never changes, whereas dynamic maps create harder questions:

  • When should old tiles expire?

  • How quickly must an update appear?

  • Can stale data be served briefly?

  • Does a style change require new tiles?

  • Can one region be refreshed without rebuilding everything?

The answers depend on the map's purpose. A geological reference map can tolerate very long cache lifetimes. An emergency incident layer may require much shorter ones.

Caching and storage are not the same thing

A cached tile is usually a delivery artifact rather than the authoritative dataset: it may be simplified, styled, filtered or rendered into pixels. Removing the source database because the tiles are cached would therefore make later editing and analysis difficult or impossible.

Keep the source and generation process separate from the cache.

Client-side caching does not eliminate initial cost

A returning visitor may load a map quickly because resources are cached, while a first-time visitor still downloads everything. Performance measurements should therefore distinguish cold-cache and warm-cache behaviour.

A map that only feels fast after all assets have already been downloaded can still provide a poor first experience.

Caching interacts with privacy and access control

Public map tiles can often be cached broadly.

Private or user-specific responses require more care. A cache must not accidentally serve one user's authorized data to another user because the cache key ignored identity or permission state.

Access-sensitive resources may need private caching rules, signed URLs or no shared caching at all.

Good cache design begins with update semantics

Before deciding how aggressively to cache a map, ask:

  • how frequently does the source change?

  • how quickly must viewers see updates?

  • is the resource public or access-controlled?

  • can responses be versioned immutably?

  • how expensive are they to regenerate?

Caching is most reliable when those update semantics are explicit rather than added as an afterthought.

Cache headers communicate reuse rules

HTTP caching commonly relies on response metadata such as cache-control directives, validators and expiry times.

Those rules help browsers and intermediary caches decide whether a stored response can be reused or needs revalidation. A technically cacheable tile can still perform poorly if every request is configured to bypass or immediately expire the cache.

Immutable versioned assets simplify invalidation

One robust pattern is to publish generated map artifacts under version-specific paths. When data or style changes, a new version receives a new path while the old version can remain cached safely.

This avoids the ambiguity of replacing content behind the same URL and waiting for every cache to notice. It also improves reproducibility because a published map can continue to reference the exact artifacts associated with its version.

Related content