Using KV as a cache in the short term?

I am hooking up my backend to my frontend this weekend and eventually I want to use a service worker for caching. Until then I was planning on using KV as a cache for specific requests that don't change often. I was looking at the Cache API but since the cache only caches at the originating data center... it seems like KV would be a a better option. From a strategy perspective... is this a good move? Am I not thinking about something that I should be?
3 Replies
zegevlier
zegevlier2y ago
I think this question depends on the cost of the request hitting your origin. KV hot reads are very fast, but they'll only be hot if they've been hit recently, just like the cache API. KV cold reads are probably not going to be faster than your origin, unless your origin is quite slow or really far away. If the cost of a request hitting your origin are higher than a request at KV costs (factoring in writes to put the data there as well, and storage to have the data stored there), then it seems like a good plan. Otherwise, I don't see much reason to.
danboyle8637
danboyle86372y ago
Awesome. thanks for that answer. Gave me some good research and and things to think about!
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server