How to clear cache automatic

I more than million posts. And my content is constantly updated. After the update is complete, delete the cache immediately (automatically). Is there any way with cloudfare?

I use page rules => cache level => everything.

Your website needs to send Cloudflare the Purge Command upon update. Cloudflare has no way of knowing if you’ve updated something unless it constantly queries your site, which isn’t feasible.

I’m coder php. I will send ‘link need to clear cache’ with my query. But I need something from cloudflare.

It would be great if cloudflare had this functionality.

And you will get money from members according to the number of cached pages.

What would that be?

If you can suggest a way Cloudflare can do this, I’m sure they would love to hear it.

When I send the my url. And cloudflare get all the urls I send. Then clear the cache of that url. I think it is not difficult for you.

Disable the cache and you are good

1 Like

Correct. It’s not that difficult. As a PHP coder, you can use the API to send Cloudflare all the URLs you want to purge.

https://api.cloudflare.com/#zone-purge-files-by-url

2 Likes

Capture2

I get an error message when using curl with php.

after https://api.cloudflare.com/client/v4/zones/ is [id] of domain. But i setting [id] in default example ^^.

I succeeded. Thank you very much sdayman … and both sandro :grinning: :grinning: :grinning:

1 Like

Awesome! Have fun with it!

1 Like

Wait, I have a few questions.

How many urls are allowed to submit in one time curl?
How many maximum curl is sent in 1 minute?

(max url = ? / 1 curl and max curl = ? / 1 minutes)

with free plan and pro plan

I’ve never tried API for purge by URL, and have no idea on the limits. I suggest you ask Support, then let us know what they say.

Login to Cloudflare and then contact Cloudflare Support by clicking on the Get More Help button.

1 Like

All calls through the Cloudflare Client API are rate-limited to 1200 every 5 minutes.

Here’s what I suggest -

  • Use time based cache (Recommended)
  • Alternative: Full HTML purge (while keeping static content at other CDN)
2 Likes

You mean: use multiple CDN on single website. after “Purge Everything” on Cloudflare => Still exist HTML cache of other CDN? (Or HTML cache of my vps)

I simply mean –

Serve HTML Document from example.com or www.example.com but its commonly accessed static resources should be served from static.example.com which should point to a different CDN solution.

Why? This way static subdomain will have better Cache HIT ratio if doing full purge via example.com

1 Like