Control your Cache

Put Browser Cacheing Issues to Rest

If I told you all you needed to do was toggle a System Setting to determine whether or not the assets of your choosing are loaded fresh from the server, or allowed to be cached, you might like that.

You can install Cachebuster through the Package Manager, or by downloading it here.

If you are curious how it works, let's walk through it...

Cachebuster works of the fundamental principal that all you need to do to make a browser load an assets fresh, is change the URL. Easiest way to do that is tack on a URL parameter used for cache control.

The cachebuster Snippet is actually really simple. Called uncached, it will return a truly unique identifer.

return time();

The smartcache Chunk makes clever use of the above Snippet by checking the value of a System Setting and either printing your current Site Version or a truly unique identifer.


If the cb.cachebust System Setting is set to no, then the cb.site_ver System Setting will be displayed. Otherwise, a truly unique identifier is printed uncached. (It prints the number of seconds since Jan 1, 1970 so it's pretty specific.)

Each time you make changes to your website, such as updates to stylesheets you should increment your cb.site_ver System Setting.

You can optionally pass in a parameter to prepend to the result of smart cache like so:


Would output either:




Comments (0)

Add a Comment

Allowed tags: <b><i><br>Comment:

** CB is not responsible for fixing cache-related bugs **