How to ensure you’ve fully cleared the cache
When testing your website, for speed to or checking errors. It’s really important to ensure you have cleared every single cache that may affect what you are actually seeing.
A good friend of mine and one of my website speed clients, had this exact issue yesterday. We were chatting about it on a zoom, screen share. I was telling him about when exactly the same thing had happened to me in the past. You tweak a setting in your current cache plugin, something breaks or acts weird on your website and you obviously blame the plugin you are using. However, turning the option back off doesn’t fix the issue. It should, but it doesn’t. Further digging reveals that it’s an old stale cache folder on your server that is causing the issue, cache from a plugin you’ve long since deleted. Removing it fixes the issue. But how do you do that?
What is Cache?
In website terms, a cache is a store of your website data, that can load faster than if you were trying to get the items from the server one by one. In simple speak, it means that every time your website loads it has to load a certain number of requests. An image, a bit of code, a font etc. Caching puts all these elements together in one or more cache files. Because they are grouped together they can load faster on the next visit to the site. The problem is, what if you change something – a setting, edit a blog post or change a font maybe. Well, if you are seeing the cached version, you won’t see the change taking effect. So for instance, in speed terms. If you tweak a setting then check the speed of your site, how do you know that setting has actually take effect?
Different Levels of Cache
One of the issues with cache problems, is there are different levels of caching. The first level is your web browser. Every browser caches websites when you visit them. It does this, so that the next time you visit that site, it can load it quicker. That’s great. It speeds things up for us when we re-visit websites. But its also a pain, if we have changed something on our website and the change isn’t showing when you visit the page. We need to clear this cache.
Most web browsers have a simple way of clearing their browser cache.
Safari – go to Safari preferences, advanced tab. Tick Show Develop menu in menu bar. Now, you will see a new menu item appear. The Develop menu. Pull that menu down and halfway down the list you will see Empty Cache.
Chrome – Pull down the Chrome menu far left on a mac and it says “Clear Browsing Data”. This will bring up a sub-window, where it gives you the chance to clear history, cookies and lastly cached images and files. You can tick or untick as you wish. But clear the cache.
If you are using some kind of caching plugin on your WordPress site, then it will be creating cache files and folders inside your main Cache Folder on your server. If you FTP your server, you can see them in the wp-content folder.
Warning: Do not delete the Cache folder!
In most instances, you can clear your server cache using the plugin itself. So all of the popular caching plugins will come with a Purge Cache option. It may offer you choices of purging just the URL you are on or purging the whole cache. This won’t hurt. You won’t break anything. It merely means you are asking it to refresh the cache, by creating a new version of it.
However, sometimes this doesn’t work – and it’s hard to work out why. It’s nearly always because you have an older cache plugin still operating behind the scenes on your server, even though you long deleted it. Deleting a plugin does not always remove all the old residue of the plugin. Bits can be left inside the server such as old configuration files (these don’t hurt). It means if you reinstall the plugin, it remembers the settings you last used. But other parts of left, such as old stale cache. This can be a big issue. Because you no longer have the plugin, you can’t clear it via the plugin. So you need to go digging in your server files. So FTP your server and find the Cache Folder, as shown above.
While you must not delete the cache folder. The items inside are those created by your caching plugin. So if you were to delete them, they will simply be recreated by the plugin. To be super safe, I’d always make a backup of the cache folder, give it another name, that way if you delete anything by mistake or you get issues, you can simply restore it from the backup folder. Calling the backup cache folder “backup-cache” for instance means the server won’t read that folder when it loads the website.
Many times, strange issues can occur when you are tweaking settings in your cache plugins. And purging the cache in the plugin, doesn’t actually take effect. Often times these issues can be found by looking in the server Cache Folder and you find that some old plugin that you have stopped using still has a folder in there, delivering old stale cache. Clearing those folders out – or simply clearing out the contents of the folders means that stale cache is removed.
How do I know which cache was created by which plugin?
I was asking myself the same question. A quick google took me to WP Rocket’s help pages where there is a full list of the common folders that various cache plugins create.
WP Rocket is responsible for the following four folders:
So you know that all other folders in there have nothing to do with WP Rocket. Other cache plugins are also listed there, which is really helpful.
BTW – you should never be using more than one WordPress cache plugin at a time. You will run into issues where you get stale cache being served. So make sure that in your Cache Folder, there is only the folders for the plugin you are using.
This should cure any strange caching issues you may be having.
That is unless you have another layer of cache involved in the process. For my own main website, I do. It is controlled by my hosting company, so it has a cloud based cache level. Whenever I do changes to that website, I need to make sure brewer, server and cloud are cleared. But most hosting companies do not have this extra level of caching.