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 the method of clearing out old or unneeded data from a cache. This process ensures that only the most relevant and up-to-date information is kept.

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 understand what cache purging is, let’s discuss its pros and cons. Using a Content Delivery Network (CDN) like Cloudflare, Servebolt CDN, or Accelerated Domains distributes your website’s cache across multiple nodes worldwide. This setup lets visitors quickly access cached elements, such as images, CSS, JavaScript, or HTML, from the nearest CDN node, ensuring faster delivery of your website’s assets.

The “Purge Everything” button in Cloudflare or the Servebolt Optimizer plugin is convenient but can hurt performance. It clears every cached item for your entire domain on every CDN node in the network. This forces all CDN nodes to rebuild the cache by fetching all assets from the origin again, which takes time and degrades performance for the end user until the cache is rebuilt.

If available, a better option is to use the “Custom Purge” feature. This feature allows you to purge specific paths instead of clearing all your static elements and HTML pages, helping maintain better performance while still updating necessary parts of your site.

Image from the Cloudflare dashboard, showcasing the purge capabilities

Pros of purging cache

  • You can purge the cache to update elements directly of your website if it’s not done automatically. This allows you to clear out old or unneeded data from a cache. Purging the cache ensures that only the most relevant and up-to-date information is kept.

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 purging a single URL.
  • Dynamic Requests will increase as elements of your website need to be fetched from the origin server instead. 
  • The cache needs to be rebuilt and redistributed with the use of CDN services. 

If you’d like to learn more about caching, make sure to check out our guide on how to ensure that static resources in WordPress are updated correctly when using our built in static cache.

And as always, should you have any additional questions please don’t hesitate to contact our support chat at servebolt.com!