CF Worker/Cache API consistency

Looks like Cloudflare doesn’t guarantee for which worker instance/data center the network will choose, and we can get 10 different ones even when connecting from the same location.

So if my CF Worker interacts with Cache API, does it choose the closest region for cache data center relative to the Cloudflare Worker invocation?
And does that mean that cache.match can return no match even if the page was already cached?

If a worker goes to a specific datacenter, then the cache and cache API will hit that datacenter’s cache. Of course, your cache might be evicted if the cache is getting full or your resource isn’t popular enough.

Not really, assuming you’re talking about requests for the same origin. While it could change suddenly if the data center itself is under DDOS attack/heavy load and has to reroute some traffic elsewhere, you won’t see different locations for the same website in the same session.

yes.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.