Cleaning up Web Cache API #18925
alexgleason
started this conversation in
General
Replies: 1 comment 2 replies
-
This is a really annoying problem, if anyone from Deno could give a better solution that would be great. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm heavily using the Web Cache API to cache results from dynamic URL queries. It needs to be cleaned up every couple days to prevent filling the entire disk, so I've added a stupid cron job that does this:
(It takes ~20 minutes to delete the cache directory, so it's faster to move it and delete it afterwards)
I'm already adding an
Expires
header before inserting a Response into the cache. Sidenote: Cloudflare Workers clean up expired responses automatically. I'm thinking I need to emulate CF's behavior by enumerating every key in the cache and deleting expired ones, on a time interval (eg every 60 seconds). I'm a bit concerned it will be an intensive job and thinking about doing it in a Web Worker.Anyone have experience with this?
Beta Was this translation helpful? Give feedback.
All reactions