Are you enjoying the extensions? Did you like the support? Help others decide.

Leave a review

You can eliminate cache issues in SimplifyYourWeb extensions

First published November 05, 2023
1234 hits -

You have been setting up one of the extensions downloaded from this site and you are having a difficult time understanding what is going on with some of the advanced parameters... What is site mode? Why are my changes not reflected on the live site? Can you make it easier for me?

To understand the how, you have to know the why.

The extensions I have created have a large number of settings that can affect CSS output, the need for scripts or the creation of image thumbnails. All this comes to a cost: the server needs to process data in real time and it not only needs processing time, it needs processing power. If you have a high traffic website, this can't possibly be happening every time someone accesses a page on your site.

This is why I have introduced the site mode advanced parameter. When set to 'test', the extension creates stylesheets, scripts and images at every page access, so you can keep testing your changes on the fly. Once you are done with tweaking the parameters, or your site is about to become live, you can set the site mode to 'live', which basically tells the extension to cache stylesheets, scripts and images and avoid unnecessary processing. Your server and the visitors of the site will thank you...

The extension's test mode
The extension's test mode

Now, what happens if you want to change a parameter or tweak some CSS after the extension's assets and media have been cached? 

Well, you need to change the site mode back to 'test', check the changes and set site mode to 'live' again. Not very convenient...

In Joomla 3, the cached files are located in the Joomla cache area. You have the option to empty the Joomla cache in the administrator console. Easy, especially if you downloaded one of the cool extensions out there that helps clearing the cache at the click of a button. 

The Joomla 3 cache page
The Joomla 3 cache console page

In Joomla 4, you no longer have that option. Why? Because the cached files are now placed in the media cache /media/cache, which did not exist in Joomla 3. And that cache has no interface in the administrator console, it is hidden from view. You could use one of the cool extensions for cache reset, but emptying a specific folder usually comes to the price of buying a 'pro' version.

So are all hopes lost?

Not quite. Since version 2.5.0, the Simplify Yor Web extensions library (used by all my extensions) contains a mechanism that automatically empties the files that are cached when your module, plugin or menu item is in 'live' mode. No more thinking about it. So, check your site's extensions updates and look for the library!

A message after clearing the media cache
On module save, message showing after files have been cleared from the media cache

Ok, well, that works fine with styles and scripts, but what about images?

If you want the benefit of having the images re-created after you change settings, you should make sure you select the 'cache folder' as the Thumbnails cache path.

Picture cache settings
The picture cache settings

For re-creating images after a user has edited an article, for instance, you should also download and setup the Auto Clear Cached Image system plugin.

With this particular setup, making changes on a live site will no longer be as challenging as before...