-
Notifications
You must be signed in to change notification settings - Fork 167
feat: cloudflare cache runtime api #603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Really smart approach. Honestly i'm not 💯 sure it would be best case of using unstorage (Nitro v3 rather can directly leverage caches API on top of web response handling) But let's keep both on the track and tested. |
If Nitro v3 can do cached event handlers and functions directly via the cache API then I think may not be necessary then 😄 Happy for you to close if Nitro is handling it better. |
@RihanArfan any update on this? (have you tested this solution on prod?) |
This isn't Cloudflare-specific. It's using the |
@ascorbic Cloudflare's implementation of the Cache API is slightly different from the web standard - https://developers.cloudflare.com/workers/runtime-apis/cache/#accessing-cache Most notably, there's no way to list all keys - https://developer.mozilla.org/en-US/docs/Web/API/CacheStorage/keys @pi0 Unfortunately haven't been able to yet sorry |
@RihanArfan is there a way to implement this in a cross-platform way though, that supports runtimes that implement the web standard too |
Netlify would also be interested in this. |
@eduardoboucas while making this one generic could take time (or not be possible), if you have time to draft a driver for netlify, i can merge and release. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #603 +/- ##
==========================================
+ Coverage 59.99% 61.83% +1.84%
==========================================
Files 42 44 +2
Lines 3657 3962 +305
Branches 590 661 +71
==========================================
+ Hits 2194 2450 +256
- Misses 1460 1509 +49
Partials 3 3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Disabled tests with a manual test for now (works in prod sandbox with using @dario-piotrowicz @petebacondarwin could you please kindly review this PR and confirm if i am not mistaking and wrangler dev proxy does not implement caches API? |
I am not very familiar with this codebase unfortunately, but by quickly skimming through the PR it all seems correct to me 🙂 Regarding the cache not being implemented you're right, we also have an issue for this: cloudflare/workers-sdk#4879 (which refers to (PS: Running code inside (PS: sorry for the late reply, I only now saw this 🙇) |
resolves #602, #573
TODO: