When Should Website Cache be Purged?

In this article, we’ll discuss what cache purging is and the pros and cons of purging the cache of your website.

What is cache purging?

Purging, clearing, flushing or cleaning cache are some of the words used to describe manual removal of all resources in the cache. In most intelligent cache engines, just like our Accelerated Domains, the cache will automatically be purged whenever a page or resource has been updated on your website. Purging cache in Cloudflare or Accelerated Domains also allows you to purge cache based on URL or purge all cache if needed directly in the UI of Servebolt Optimizer Plugin.

Image showing the cache purge options in Servebolt's Servebolt Optimizer plugin for WordPress

When should the cache be purged?

Now that we know the basics of what purging cache means, let’s talk about the pros and cons of purging cache. If for example, you use a Content Delivery Network (CDN) like Cloudflare, Servebolt CDN or Accelerated Domains then the cache of your website will be distributed across multiple nodes all around the world. Distributing the cache of your website allows visitors of your website to fetch cached elements like static assets (images, CSS, JS) or HTML cache directly from the nearest CDN node. This will ensure a faster delivery of your website’s assets to the visitors of your site.

Pros of purging cache

  • You can purge the cache to update elements directly of your website if it’s not done automatically. 

Cons of purging cache

  • Purging the already distributed and “warmed up” cache will lead to poorer performance and make your site less scalable before it warms up again. It’s even worse to purge all the cache of your website instead of a single URL.
  • Dynamic Requests will increase as elements of your website need to be fetched from the origin server instead. 
  • Cache needs to be rebuilt and redistributed with the use of CDN services. 

Conclusion

Be careful with purging cache as it may lead to poorer performance, scalability, unforeseen issues and a higher number of Dynamic Requests to your origin server. If you must purge cache for your website then you should rather purge cache for a URL/directory instead of purging everything/all cache.

Enabling development mode in our Control Panel or in Cloudflare doesn’t purge the cache, but it temporarily disables the cache for testing purposes.



Also check out how to ensure that static resources in WordPress are updated correctly when using our built in static cache.