How to clear all caches in OpenCart 3.0.2.0

Posted by Paul on August 20, 2018

Caches can be the absolute bane of a developer's life, but what exactly are they, why can they be annoying, and how can we make them less annoying?

What are caches?

When a user browses to your website, the web server has to do a whole load of computation to make the HTML that makes the page. This takes time and puts load on the server. A cache is a way to store that HTML, usually in a file, on the assumption that the result of the computation won't have changed from the last time it was saved. It's a bit like the webserver saying "here's one I made earlier". 

Doing this can drastically speed up a website, potentially by 10,000 times, and mean the difference between a busy server staying alive or crashing. So they have their uses.

What's the problem?

The problem is when a cache doesn't clear so a user starts seeing outdated content. There are various solutions - ways the cache can try and guess when to clear itself - but most of them are guesses because to know for sure if the output has changed, the server has to compute the output which defeats the object.

What's the answer?

As a developer, or store owner, you may make a change somewhere in your online shop and not see that change being applied on the front-end. In that case you probably need to clear your caches, but there is more than one so it helps to be aware of what caches there are and how to clear them.

Caches that may be affecting an OpenCart 3 Online Store

Please not that doing the actions below can cause errors to show that had been hidden before, so you may need a developer on hand if your shop is busy and live. 

Browser

Your web browser itself (Edge, Chrome, Firefox, Safari) may be storing copies of CSS, JavaScript or HTML. Clearing this is different for all browsers but there are great instructions here:
https://www.refreshyourcache.com/en/home/

ISP

On very rare occasions your ISP (BT, Virgin, Plusnet) may cache content. This is rare and there isn't much you can do about it so we won't discuss this any further here.

CloudFlare (or other CDN)

If you are using CloudFlare or another Content Delivery Network, they may be caching content and making things appear strangely so this is worth checking if you use one. You'll know if you do because it would have had to be set up specially. 

Twig/SASS (Template)

In the OpenCart admin on the Dashboard click the gear icon in the top right and then click the yellow refresh button next to Theme and SASS.

OpenCart Theme Editor

In OpenCart 3, there is a built-in Theme Editor in the admin, which seems like a good idea until you know that once you use it, no extensions are able to modify templates and no changes to the template files take effect. This is certainly a gotcha to be aware of.

Cache Extensions

There are various caching extensions such as NitroPack Cache, Increase Page Speed and many many others. These will work by creating cache files so you will need to find out the specific way to clear the cache for your extension if you have one installed.

OCMOD

In the OpenCart admin go to Extensions > Modifications, then click the yellow clear button and the blue refresh button.

vQcache

If you have vQmod installed, there will be a folder called /vqmod/vqcache. To clear it, it can be best to make a copy of it and then manually delete the files inside it. If clearing this cache causes errors, you can then put your copy back. 

And that's probably all of them for now, unless you can think of any others? If so let us know in the comments!

If you would like a custom OpenCart theme, or want to use one of our existing themes, get in touch here.

blog comments powered by Disqus