Caching across multiple parallel worker requests

What happens if you have multiple parallel worker requests from same colo that make use of the Cache API and there is a Cache Miss, the key/data stored in the Cache API is the same in all requests. - Do all the worker requests try to hit the origin at once or are things smart enough to so that only one worker request hits the origin and the rest will pull from the Cache?
1 Reply
Chaika
Chaika2mo ago
If you use fetch w/ cache yes: https://developers.cloudflare.com/cache/concepts/revalidation/#example-2 If you're manually using cache.match and catch.put how it would ever know you're going to put it in after/not just checking? It'd run and store multiple times
Cloudflare Docs
Revalidation and request collapsing | Cloudflare Cache (CDN) docs
Revalidation is a caching mechanism that involves checking the freshness of cached data before serving it to a client or user. If a cached object is no longer fresh and Cloudflare receives a request for it, a request is made to the origin to revalidate the object in the Cloudflare cache.
Want results from more Discord servers?
Add your server