This worker uses Cache API to cache responses.
Question: When cache-reader fetches from here, does it get the cached response?
This endpoint uses caches.default to cache its response.
On first call: generates fresh response, stores in cache.
On subsequent calls: serves from cache (same requestId).
Call /cached-endpoint Clear Cache Check Cache
// On each request:
const cached = await cache.match(request);
if (cached) {
return cached; // HIT - serve from cache
}
// MISS - create response and cache it
const response = new Response(data);
await cache.put(request, response.clone());
return response;
Go to Cache Reader - Test Writer Cache
This will:
| Header | Meaning |
|---|---|
X-Cache-Writer-Status | HIT = served from Cache API, MISS = fresh |
X-Writer-Request-Id | Unique per fresh response. Same ID = cached. |
X-Served-From | cache-api or origin |