Documentation menu

Concepts

Caching

How Wayline's response cache works, how cached results are billed, and how to cache distances and drive times in your own application safely.

Updated Dec 1, 2026 View Markdown

Server-side cache

Wayline caches identical requests for a short time. The X-Cache header shows HIT or MISS. Cache keys include the region's map_version, so a map update never serves stale geometry. Cache hits are billed like fresh results; the cache exists to keep latency low.

Caching in your application

Distances between fixed points change only when the map changes, so client-side caching is often the biggest cost saver:

  • Key your cache by rounded coordinates (5 decimal places ≈ 1 m), endpoint and parameters.
  • Store map_version with each value. When GET /v1/coverage reports a new version, refresh lazily.
  • TTL: days to weeks is reasonable for distance/drive time without traffic.
  • Respect your terms — see the Terms of Service for permitted storage of results.

What not to cache

Don't cache error responses for long, and don't cache 429 responses at all.