This is the documentation for concrete5 version 5.6 and earlier. View Current Documentation

concrete5 v5.6.1 introduces the on_cache_flush event, triggered whenever the core cache is flushed. See https://github.com/concrete5/concrete5/pull/848

Some addons keep their own local caches that are (by design necessity) outside of the core cache mechanisms.

By responding to the on_cache_flush event, such addons can clear their internal cache whenever the system cache is cleared.

For example, in a package controller:

public function on_start(){
  Events::extend('on_cache_flush', 'MyPackageClass', 'cache_flush_handler', DIR_PACKAGES. '/my_package_class/controller.php');
}

public function cache_flush_handler(){
  // code to clear out the addon specific cache
}

For those developing event handlers, the Event Tester addon can be a useful diagnostic tool.

Read more How-tos by JohntheFish

Loading Conversation