Documentation

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 concrete5 cache
  • The overrides cache

The cache clearing method used by the Cache Vac job is controlled by a single (optional) config/site.php definition CACHE_VAC_METHOD.

define('CACHE_VAC_METHOD', 'default');

Available options are:

  • (default) - flush by the standard C5 method, equivalent of the dashboard flush command.
  • 'expired entries' - flush files associated with expired entries only, by a variation of the code used by the dashboard flush command.
  • 'older than' - clear zend_cache entries older than 1 week.
  • 'older than xxxxx' - clear zend_cache entries older than xxxxx seconds.
  • 'stomp' - remove all files in the cache folder
  • 'all'  - as per 'stomp'

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.