This document is a great overview of the different caching options: https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching. The caching headers that you decide use will vary based on your application's use cases. I encourage you to read through the options and test out a few of them, to see what works best.
I love the simplicity of KV for storing things like assets, and caches personally. Those things might not change for days, weeks, or months, so I just don’t need strong consistency.
You can’t put CDN cache in front of a worker. You could use workers cache api but that’s still gonna incur a cold read to R2 which’ll be slower than KV
In this api, it doesn’t change often. And if it does, it’s something like an avatar which is okay to be a little out of date. We arbitrarily set keys to expire after 7 days if I recall
if my understanding is correct, it doesn't replace the assets, but rather the mapping between paths and KV entries, so an entry is only ever written to once
i see, my question was more about the latency / cache invalidation part, which I still don't really understand. Is there another database used for the mappings and if no how can kv instantly serve the old mappings?