Caching with R2 and worker

I’m trying to build an API with workers that also serve files from R2. I would like to make use of CF’s caching as much as possible.

Approach 1

get the object from the R2 bucket and cache it through the Cache API ( This appears to the standard approach. The downside is that it doesn’t use tiered caching and only caches at the request data centre.

Approach 2

fetch the object in the worker from the public R2 bucket and benefit from the tiered caching. The downside is that R2 bucket is public although this isn’t a problem in this particular use case.

My questions

  1. Is using the tiered caching worth the extra effort when pulling object from R2?
  2. Would I still need to use the Cache API from the fetched object in approach 2 when I want to use the lowest level cache?
  3. Are there other downsides for approach 2, or better ways to approach it?

I would be happy about any insights or ideas.

1 Like

It seems like you should still pay for such workers.