In some situations, it may be advantageous to disable automated cache cleaning in concrete5, as described by Andrew Embler in Improving the Performance of Zend Cache. However, the cache will then need to be periodically cleaned up to prevent it growing forever.
Site admins may have other reasons why they may want to periodically clear the concrete5 cache.
This addon installs a job which will empty:
The cache clearing method used by the Cache Vac job is controlled by a single (optional) config/site.php definition CACHE_VAC_METHOD.
Available options are:
If the installed version of concrete5 also has an overrides cache, that will also be fully cleared, whatever CACHE_VAC_METHOD is set.
The clearing method can alternatively be configured using the job url parameter 'cvp'. If using url parameters some characters will need to be escaped.
The job is best run individually using cron or FlexJob Scheduler at set times.
Internally, Cache Vac uses variations of code posted on the concrete5 forums at /forums/usage/concrete5-horribly-slow/#319367 and /community-leaders-area/community-leaders-discussion/zend-cache-setting-how-to-manage-file-size/#420969.
A simpler Clear Cache addon job to just flush the cache as per the concrete5 dashboard command is also available.
Beware of clearing the cache too often, it could have a negative impact on site performance. After clearing the cache, it may improve the load time for the next site visitor if you load the home page or other key pages in order to pre-populate the cache. Using cron, this can be done with a wget of the page url, or you can use the Cache Filler job.