Cloudflare cache expiry time

Hi community

I run a ecommerce shop with woocommerce and I have litespeed cache and cloudflare enabled. I am also running on a litespeed server. I want to ask how long does cloudflare store its static resources under its edge server before it purges? If I make modification with my css, html, js, and images, will cloudflare auto detects modification and perform a purge or do I have to manually purge on cloudflare? Is it possible to increase the lifetime of the static cache content? I heard from some posts that cloudflare only store cache content for 2 hours with a free cloudflare plan. And 1 hour or shorter with cloudflare subscription plan. Dont exactly understand why I would want to shorten the cache lifespan with a cloudflare subscription plan. I want the static cache content to last longer on cloudflare since I dont get a lot of visitors on a single page per day. I want it to last for at least a month so all visitors will be served cached content on every product page in a given month.

Thank you

Cloudflare caching really works in the opposite way you’d expect. When you set an expiry time, it’s a maximum amount of time it’s safe to cache an asset. That’s why the Minimum amount of time that you quoted is shorter on higher plans. Those are high-traffic sites with constantly populated caches, but they don’t want some content to remain static for an extended amount of time.

What you’re asking is for Cloudflare to store all your stuff for free for a month, even though nobody will be using it for extended periods of time. That stuff will get evicted from the cache to make room for content that’s actually used on a regular basis.


No, Cloudflare does not detect anything automatically. You would have to do this on your own, but you can automize that and automatically run a script on every content change passing the affected URLs to the script which then will purge their cache at Cloudflare’s Edge.

But care: on Cloudflare all content changes will come with a heavy drop in performance, that’s how Cloudflare as a reverse proxy CDN works.

That’s somewhat correct, but no one will ever know how long exactly a cached file will last in Cloudflare’s Edge Cache. On Cloudflare in total, there is not and never was any guaranteed service performance wise.

Why they offer even shorter TTLs on higher plans @sdayman just explained. But please keep in mind, that this optional to EVERY other TTL they offer, so feel free to adjust the TTL to fit your needs.

A lot of people do have the same requirement and if you need this I would recommend you switching away from Cloudflare as Cloudflare does not give you:

  1. guaranteed Cache (this anyway should not be free)
  2. control over your cache (beside a “purge”)
  3. propagation of your cache

Other CDN services which let you push your cache files against them and propagate them will most probably do better for you, they also do not have the first very slow request/TTFB as they are able to prebuild and propagate cache.

First TTL is not a guaranteed time at all, it is a wished or expected time, but never a guaranteed one. It’s the “Time To Life”. A humans TTL is about 90 years. Maybe you will live for 90 years, probably you die earlier, no one can really tell. It’s the same for cache at Cloudflare.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.