Edge Cache TTL Help


Im looking for some clarification on the page rule function “Edge Cache TTL”

It’s my understanding that after the set period expires, the cached item will be removed from the Cloudflare cache. But Im not sure what happens next, does Cloudflare itself get a fresh copy of the item from the origin server or does the file have to be accessed by means of a user browsing the site?

Thanks for reading

That’s right. Cloudflare does not cache pages automatically. It does the caching during the first visit to a URL, if the site is properly set to have that URL cached. CF will only cache that page/file at the datacenter that was used to serve the page to the user.

Cached URLs will remain on cache at the datacenters where they were served for the time specified on the Edge Cache TTL but may be dropped earlier if there are rare visits to that URL afterwards.

1 Like

Thanks @floripare that answers my question perfectly!

It does make me wonder if there is a way of manually populating the cache in case of the need of a full purge, do you know of any way?

1 Like

I also noticed this in the link you posted, its an interesting choice of words?

“A Pro customer may set the refetch time to 1 hour. After 60 minutes, we return to your server for a fresh copy of the resource. Business customers may lower the refetch interval to 30 minutes. Enterprise customers may set this interval as low as 30 seconds.”

I’m afraid they are referring to a refresh that will be done if, and only if, a visitor comes by. So while on the free plan you can set Edge Cache TTL at a minimum of 2 hours, other plans will let you set this to a smaller time interval, which could be crucial for instance, for a news website. Depending on how dynamic is the content you offer, you may benefit from upgrading your plan.

This post by @eva2000 ofers a how-to on how to run a script/cronjob to make sure your files are always cached by the time a visitor comes by (though this will not change the minimum Edge Cache TTL):

thanks again @floripare ill look into that :+1:

1 Like

This topic was automatically closed after 31 days. New replies are no longer allowed.