If you make an edit to one of your posts and find that you can’t see the changes immediately but want them to be available, that would be a good reason to purge cache manually. Most caching plugins are set up to purge the cache after a certain amount of time.
Like once a day or once every few hours, or may even once a week. And while response and fast load times are crucial for users, the freshness (or accuracy) of your content is no less important for your business reputation.
Caches are refreshed based on caching policies each website defines which determine the amount of time a given resource remains in the cache. When that duration expires, the content must be retrieved from the origin server.
If the content in the origin server has changed, the new version will be uploaded to the cache. In certain situations, however, you may not want to wait for the caching period to expire.
An example of this would be an update on your website’s pricing page or a bug on an online game. That’s where cache purging comes in.
What is Cache and When do You Need to Clear it?
Caching solutions store a static version of your website. This allows WordPress to skip running the heavier PHP scripts and improve your website speed.
There are many different type of caching solutions available. The most popular ones are WordPress caching plugins like WP Rocket and WP Super Cache. These plugins offer an easy to use interface for controlling what to cache when to expire cached content and cleaning up the cache on demand.
Related Topic: Web Browsing History | Why is it Important to Erase it?
Managed WordPress hosting providers like WP Engine also run their own caching solutions, so that you don’t have to install a caching plugin. If you are using a CDN service like MaxCDN, then they would also serve cached copies of static content.
If you’re using a web application firewall like Sucuri or Cloudflare to improve your WordPress security, then they also have their own cache to speed up your site and reduce downtime. And lastly, most modern web browsers will also store cached versions of pages on your computer.
What does “Purge Cache” mean?
The purpose of caching is to speed up the website and improve the overall user experience. However, sometimes this causes you to not see the changes you make right away which can be frustrating. In that case, you will need to clear caches to see your changes live.
Purging refers to the active removal of a resource from the cache without waiting for the predetermined cache expiry time. As soon as a user requests the purged resource, the CDN will cache a copy of the updated content from the origin server.
Purge Cache simply means to delete the HTML “copies” of your pages. So, if you purge cache, it means the next time you view your blog, it will generate the page by pulling info from the database (the original method). Then, it will recopy the page again to create a new, static HTML copy.
Related Topic: Why Cloudflare is the Best for Web Performance & Security
Content Delivery Networks (CDNs) accelerate web traffic across the internet through servers residing in strategic locations (known as points of presence or PoPs) across the globe.
Each PoP has a number of caching servers, each of which contains a cached version of your website or application. By bringing content closer to each visitor, CDNs improve performance and reduce the load on the origin server.
Therefore, caching is the raison detre for CDNs. The reason for this is a CDN’s effectiveness can be measured by the cache hit ratio. This is the percentage of requests the CDN was able to serve out of its own cache.
How is fast cache purge done?
Once you’ve decided to purge the cache, the time it takes to execute depends on your CDN. The effectiveness of a purge request is measured in the time it takes for it to propagate worldwide through the entire network.
The speed of the purge depends on several factors. Including hardware type, network size, and the number of CDN customers requesting cache purges at the same time.
While some CDNs, like Incapsula, can achieve purge times of less than 500 milliseconds, CDNs with larger networks and outdated hardware may take longer to propagate the request. And even delete the relevant content from all the caching servers.
For this reason, most CDNs let you purge a specific resource on-demand. But, some only give you the option of purging the entire site cache.
When do your use rapid cache purge?
If you’re the owner of a blog or an online academic journal whose content doesn’t change once it’s uploaded to the site, you most likely can do without purging since your content is not time-sensitive.
Other types of websites, such as news and sports sites with live updates, or e-commerce sites with frequent pricing changes, would benefit from caching policies that reflect the almost continuous information updates. This ensures that content is always fresh without requiring frequent cache purges.
However, there are situations in which rapid purging can be critical for your business and your users.
Consider, for example, the following “crisis” scenarios:
- You run an e-commerce site specializing in jewelry and you’ve run out of inventory for a popular ring. You need to temporarily remove the item from your online catalog until your supplier delivers new stock. Waiting for the cache to refresh is going to result in disgruntled customers and an increase in customer service calls.
- You’ve uploaded new content to your website around an important product launch and discovered a bug in one of the pages. A major PR campaign is underway driving thousands of daily visitors to your site and you can’t afford a mishap. In such a case, the content must be corrected and replaced immediately with the updated version. Failure to do so could result in substantial reputation loss.
- You’ve just updated or patched your online game and want to be sure that the latest version is available to your users. If the old version contained a critical error, your users are likely to go elsewhere for their gaming entertainment.
In addition to the above, there are applications and websites with cacheable content. Where certain types of business activities will trigger the need for an immediate purge.
The removal of an account from a photo-sharing application should result in the deletion of all photos related to that account. As soon the photos are deleted from the application database, you need to be sure that there are no traces of those photos on caching servers located around the world.
You own a blog and decide to delete an outdated blog post from your online platform. Similar to the example above, you don’t want copies of the deleted post to be accessed from your CDN’s caching servers.
If you need to respond quickly to business triggers or handle an emergency fix, and your changes need to be propagated across the CDN immediately, rapid purging is the answer.
The goal is real-time syncing
Most web developers and website owners want the ability to control their cached content in a manner similar to how they manage their database. This means that the CDN caching mechanism should be easy to use and allows instant propagation of changes or fast purging.
Fast purging means near real-time syncing between the origin server (the application database) and the CDN. It’s designed to minimize the delay between updates to the application resources. Such as database and files, and updates of the cached resource.
As a result, this allows website owners to be in full control of what their visitors see. The graphic above shows data on all PoPs are instantly synced.
The second graphic below shows the PoP serving traffic to the user is not synced in time. Resulting in a data integrity issue where the user can only view old cached content.
Most caching plugins are set up to purge the cache after a certain amount of time. Like once a day or once every few hours, or maybe even once a week.
But, if you make an edit to one of your posts and find that you can’t see the changes immediately but want them to be available, that would be a good reason to manually purge the cache.
How to Purge Cache resources from Cloudflare
The Caching app in your Cloudflare dashboard allows purge of cached resources by single-file (recommended), hostname or cache-tag (Enterprise plans only), or all cached content. All customers can purge by single-file (by URL) or purge all cached assets.
Cloudflare Enterprise customers can also purge using hostnames and cache-tags. Purge requests will appear in Cloudflare Logs and are easily identifiable by the PURGE method and the Cloudflare-branded User-Agent.
Purge by single-file (by URL)
When you choose the Purge by URL (single-file) option in the Caching app, that cached resource is immediately removed from the stored assets in your Content Delivery Network (CDN) across all data centers.
Any new request for the purged asset gets the latest version from your origin web server and adds it back to your CDN cache within the specific Cloudflare data center that served the request.
Important! A single-file purge performed through your Cloudflare dashboard does not clear objects that contain:
- Custom cache keys
- An origin header
- Any of these response headers:
You can purge objects with these characteristics using an API call (Purge files by URL).
In the data/header section of the API call, you must include all headers and cache keys contained in the cached resource, along with their matching values.
Always use UTF-8 encoded URLs for single-file cache purges.
Purging by single-file through your Cloudflare dashboard
- Log in to Cloudflare and select the site with the resources to purge.
- Click the Caching app.
- In the Purge Cache pane, click Custom Purge.
- The Custom Purge dialog box appears.
- Select URL in the Purge by field.
- Enter the appropriate value(s) in the text box, using the format type shown in the example.
- Perform any additional instructions to complete the form.
- Review your entries and then click Purge.
How do you Purge everything?
To maintain optimum site performance, I strongly recommend using single-file (by URL) purging instead of a complete cache purge.
Purging everything immediately clears all resources from your CDN cache in all Cloudflare data centers. Each new request for a purged resource returns to your origin server(s) to validate the resource.
If Cloudflare can’t validate the resource, it fetches the latest version from the origin server and replaces the cached version. When a site with heavy traffic contains a lot of assets, requests to your origin server(s) can increase substantially and may result in slow site performance.
How to Purge everything through the Cloudflare dashboard
Reminder: I highly recommend performing single-file purges.
- Log in to Cloudflare and select the site with the resources to purge.
- Click the Caching app.
- In the Purge Cache pane, click Purge Everything.
- A warning dialog appears.
- If you agree, click Purge Everything.
With this in mind, you can learn more about how purging cached resources from Cloudflare using other methods is done here.
How to Clear Your Cache in WordPress
Your web browser, hosting server, and caching plugins can all serve cached content. Making it difficult for you to see the changes you made to your website right away. Clearing your WordPress cache is also the first troubleshooting advice that you’ll often hear.
Having said that, let’s take a look at how to clear your cache in WordPress using simple steps as explained in the video tutorial below;
If you don’t like the video or need more instructions, then continue reading.
Step 1: Clear Your Browser Cache
Instead of fetching a fresh copy, they may still reload the page from the cached version stored on your computer. Here is how you will clean your browser cache in Google Chrome. First, you need to click on the menu icon and then select More Tools » Clear Browsing Data.
This will bring up a popup where you can select the content you want to remove. Make sure that the cached images and files option is checked and then click on the ‘Clear browsing data’ button.
You have successfully cleared your browser cache, and you can now try visiting your website. For more details, see the guide on how to clear cache in all major browsers.
Step 2: Clear Cache in Your WordPress Caching Plugin
If you are using a WordPress caching plugin on your site, then you need to clear your plugin cache. Most caching plugins allow you to easily do that from the plugin’s Settings page.
1. Clear Cache in WP Rocket
WP Rocket is the best WordPress caching plugin on the market. The best part about using WP Rocket is that it proactively builds your WordPress cache in the background, so your users are always served a cached version.
It also makes it very easy to clear caches files with a single click.
Simply go to the Settings » WP Rocket page and click on the ‘Clear Cache’ button under the dashboard tab. WP Rocket will now clear all cached files for you.
2. Clear Cache in WP Super Cache
WP Super Cache is a popular WordPress caching plugin. It allows you to clean or purge all cached content with a single click.
You need to visit the Settings » WP Super Cache page and click on the ‘Delete Cache’ button. That’s all, WP Super Cache will now delete all cached files from your website.
3. Clear Cache in W3 Total Cache
W3 Total Cache is another popular WordPress caching plugin. It also makes it super easy to clear cache with one click.
Head over to the Performance » Dashboard page and click on the ‘empty all caches‘ button. W3 Total Cache will now delete all cached content for your site.
4. Clear Cache on WP Engine
If you are unable to notice changes take effect immediately, then you can easily clear WP Engine cache from your WordPress admin area.
You need to click on the WP Engine menu item in the admin bar and then under ‘General’ settings click on the ‘purge all caches‘ button. WP Engine will now purge all stored cache for your WordPress site.
5. Clear Cache on Bluehost
You can clear your Bluehost WordPress cache from the WordPress admin area. Simply log in to your WordPress admin area and you will notice a ‘Caching’ button in the admin toolbar. Take your mouse over and you’ll see the option to ‘Purge All’ cache.
Bluehost will now clear all files from their WordPress cache.
6. Clear Cache in SiteGround
SiteGround is a leading WordPress hosting provider that’s known for speed and top-notch customer support. They offer a built-in caching solution to improve your website performance.
You can clear SiteGround cache from your hosting account control panel as well as the WordPress admin area. I’ll show you both methods.
6.1. Clear SiteGround cache from your hosting dashboard
Login to your hosting account dashboard goes to Speed » Caching page under site tools.
From here, switch to the Dynamic cache tab. Click on the menu icon next to your domain name and then select the ‘Flush Cache‘ option.
6.2. Clear SiteGround cache from the WordPress admin dashboard
Upon activation, you need to click on the ‘Purge SG Cache‘ button in the WordPress admin toolbar. The plugin will now clear your SiteGround WordPress cache.
7. Clear Cache in Sucuri
If you’re using a WordPress firewall like Sucuri to protect your website, then they also have their own layer of caching.
You can clear the cache from your Sucuri plugin by going to Sucuri » WAF menu in your WordPress admin area.
CDN caching gives websites and web applications an effective way to reduce bandwidth costs, improve user experience, and ensure reliable content delivery. At the same time, your visitors also expect continuous access to fresh content.
Additionally, fast purging allows for real-time syncing. It’s particularly useful for reacting quickly to business triggers and crisis situations where you can’t afford to wait for the cache to refresh automatically. For this reason, whether you’re using a manual or automated purge mechanism, speed is of the essence.
Equally important, propagation times across your global CDN are critical for staying on the same page as your users. If you have recently moved your WordPress website, then you may also need to clear your DNS cache. This will ensure that you are getting the updated DNS information and accessing the newer version of your website.
Finally, I hope this article helped you learn how to clear and purge cache in your WordPress site. You may also want to see the guide on how to boost WordPress speed and performance.