Hi! In case you run concrete5 8.4.4 or higher, there's little value in using this add-on. In recent versions of concrete5, a cache buster is built-in!
Browsers can cache JavaScript and CSS to speed up loading times. However, sometimes you've made a change in your files, and you want your visitors to see the latest changes. To accomplish this, we trick browsers into believing that we're dealing with a new asset by appending a query string to the filename. That could look like this: /css/styles.css?1540295587
Features
- Setting to enable/disable in the dashboard area.
- Matching rules to include/exclude certain JavaScript or CSS files.
- A button to regenerate the timestamp, and thus forcing browsers to reload the files.
- Automatically regenates the timestamp when the concrete5 cache is flushed.
- CLI command to 'bust the cache' (c5:cache-buster)
When do I need this?
If you regularly perform updates to JavaScript and/or CSS files and you want to prevent that visitors of your website see a different website result than you because 'outdated' assets have been cached by their browser. So yes, this avoids that you have to explain that they should control+f5 their page to see the latest changes...
For developers
If you're a developer you might want to incorporate this into your deployment process. An easy way to do this is by triggering the 'on_cache_bust' event. The easiest way to do that is as follows: \Concrete\Core\Support\Facade\Events::fire('on_cache_bust');
You'd also call a CLI command via './concrete/bin/concrete5 c5:cache-buster'
See all add-ons from A3020