You have a choice of purging resources individually by file or by Cache-Tag, or invalidating all resources at once from your cache.
How do I purge everything from the cache?
We strongly recommend using single file purge instead of full cache purge in most situations.
Purging the entire cache means all resources in Cloudflare's cache are immediately invalidated and the subsequent request for each invalidated resource will go back to your origin server(s) in an attempt to revalidate the resource. If the resource can't be revalidated, the resource in Cloudflare's cache will be replaced with the newer version of the resource from your origin. If you have many assets and lots of traffic, those requests could result in a substantial increase in requests to your origin and slow down your website.
To purge everything from cache, visit the caching app in the Cloudflare dashboard.
Under Purge Cache, select 'Purge Everything' from the dropdown menu.
How do I purge a single file from the cache?
A single or limited purge leaves the rest of the resources cached so that the requests don’t have to pull content from the origin server. We recommend this option if you don’t want to slow down the site.
Purging a single file from Cloudflare's cache immediately removes that resource from Cloudflare's cache and the subsequent request for that resource will re-add that resource to the cache with the latest version served from the origin.
Note: Wildcards are not supported with single file purge at this time. So example.com/*.js will NOT work. You need to specify the exact, full path to the file, including the http://example.com/file.js or https://example.com/file.js -- those methods are distinct for cache purge purposes.
Find the Cache Purge option by going to:
- Login to your Cloudflare account.
- From the dropdown on the top left, select your domain.
- Select the Caching tab.
- Under 'Purge Cache', click on 'Purge Individual Files'
Pro Tip: Single File Cache Purge will not purge objects cached with an Origin header.
How do I purge by Cache Tag?
Cloudflare allows Enterprise customers to tag content in the cache and then purge all content with a specific Cache-Tag. Documentation here.
Clearing the Cache via API
You can also clear the cache through an API call. Review the docs here: