Workers Cache
3 hours ago
- #Serverless Architecture
- #Caching
- #Cloudflare Workers
- Workers Cache is a tiered cache placed in front of Workers, configured via a simple Wrangler config and Cache-Control headers.
- It enables cache hits to return cached responses without running the Worker, saving CPU time, and populates the cache on misses.
- Configuration is minimal: a single config block in wrangler.jsonc with caching enabled, controlled by Cache-Control headers on responses.
- Features include stale-while-revalidate for background refreshes, Vary header support for content negotiation, and per-entrypoint caching control.
- The cache is tied to the Worker, not a zone, allowing it to work across domains, workers.dev, previews, and Workers for Platforms.
- It supports multi-tenant safety via ctx.props in cache keys, ensuring separate cache entries per user or tenant for authenticated requests.
- Workers Cache integrates with frameworks like Astro, offers observability on the dashboard, and has no separate pricing SKU.