How to Flush the Cloudflare Cache

What is cache actually and what does it do?
A cache is just generated copies of your web content that are created to speed up the process of resolving a particular web page for the end user. Sometimes you may wonder why some updated content is not updating. This means you are viewing an old copy of the file, and the cache has not yet been updated.

Cache purge will immediately remove all cached content on your website, causing Cloudflare to expire all cached static resources before the button is clicked and fetch a fresh version of your website. Purging the cache will only remove cached copies of files, not the files themselves. You may need to clear the cache in Cloudflare when you want to immediately retrieve the latest version of a file on your website.

While caching helps your website load faster, it can also save outdated information, so your latest changes aren't reflected on the site. Because Cloudflare must rebuild the cache after clearing it, site performance may be temporarily degraded.

Follow these steps to clear the Cloudflare cache

  • Log in to your Cloudflare account.
  • In the left sidebar, click Websites, then click your domain name (testing.com):
  • Cloudflare -> Select domain
  • In the left sidebar, find the Caching menu, then choose the Configuration option
  • Cloudflare - Caching - Configuration
  • On the Caching Configuration page, under Purge Cache, find the cache-clearing options.
  • Cloudflare -> Caching -> Configuration - > Purge Cache options
  • You will be redirected to the caching overview page.
    Here you can purge the cache for individual pages or items or purge everything.
    Custom Purge - Specifies which pages you want to be purged
    Purge Everything - Clears the cache for the entire website

If you choose the Purge Individual Files option, you will be redirected to the next screen where you will need to enter the exact URLs of the items that should be purged.

To selectively purge the cache;

  • Click Custom Purge.
  • In the text box, type the full URL (or multiple URLs) you want to clear from the cache,
    and then click Purge.

Purging a single file from the Cloudflare cache immediately removes that resource from the Cloudflare cache, and the next request for that resource will re-add the resource to the cache with the latest version served from the origin. We recommend using this option if you don't want to slow down the site.

To clear all cache at once, click Purge Everything, and then click Purge Everything again to confirm. It may take up to 30 seconds for Cloudflare to clear the cache. Purging the entire cache means all resources in the Cloudflare cache are immediately invalidated, and the next request for each invalidated resource will go back to the origin server to attempt to re-validate the resource. If the resource cannot be revalidated, the resource in Cloudflare's cache will be replaced with the latest version of the resource from your origin. If you have a lot of resources and a lot of traffic, these requests can cause a substantial increase in requests to your origin and slow down your website.
NOTE: Once the cache is purged, the browser and server will need to re-download it, which may take some time. During this period, the loading time for purged pages may take a little longer than before the purging.

Keep in mind that you will end up slowing down your site if you constantly purge resources from your site. When you purge the cache, it means
we have to fetch all requested resources from your server. It will take up to 3 days to rebuild the cache to an optimal level depending on your site traffic. This means that your site won't perform optimally until the cache is rebuilt.

Cloudflare offers a popular Content Distribution Network (CDN) service and purging of cache is very important when your site goes through changes. Cloudflare strongly recommends using single-file (URL) to maintain optimal site performance instead of completely purging the cache.

For more information, you can refer to https://developers.cloudflare.com/cache/how-to/purge-cache/