© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Cloudflare DevelopersCD
Cloudflare Developers•12mo ago•
11 replies
an

Caches is randomly deleted

Hi, I don't know why, but my cache is set to
public, s-maxage=31536000, immutable
public, s-maxage=31536000, immutable
, and it still expires randomly after a few hours or a day. Any insights about this? Tried searching google but doesnt found any good info
I'm certain about this as I checked > 10 times, open devtools to make sure it's removed

The logic is simple; I copied it from the doc's example.
        const inCache = await caches.default.match(new Request(cacheKey, ctx.request))
        const query = new URL(ctx.request.url).searchParams
        if (inCache && !query.get('noCache'))
          return new Response(inCache.clone().body, inCache)
....
        const inCache = await caches.default.match(new Request(cacheKey, ctx.request))
        const query = new URL(ctx.request.url).searchParams
        if (inCache && !query.get('noCache'))
          return new Response(inCache.clone().body, inCache)
....


Why s-maxage: I want to share cache between across accounts
Cloudflare Developers banner
Cloudflare DevelopersJoin
Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news
85,042Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Are there import caches?
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
3y ago
Why purging cache by tags purges other caches?
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
3mo ago
Unable to delete cache inside caches.default via Queue
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
15mo ago
Wrangler 3 Worker with KV that caches static content
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
3y ago