March 21, 2012
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.
Loading Conversation
Related Tutorials
- 16
- 0
March 04, 2013
- 4
- 0
January 22, 2014
- 3
- 0
May 31, 2012
- 20
- 0
December 07, 2011
- 2
- 0
March 12, 2014
- 13
- 0
January 04, 2013
- 5
- 0
August 31, 2012
- 16
- 0
January 19, 2013
- 4
- 0
March 12, 2014
- 32
- 0
November 15, 2011
- 5
- 0
November 26, 2013
- 10
- 0
June 02, 2011
- 15
- 0
October 26, 2011
- 7
- 0
February 03, 2014
- 14
- 0
August 16, 2010
- 11
- 0
August 04, 2012
- 13
- 0
March 07, 2011
- 6
- 0
June 22, 2013
- 6
- 0
December 04, 2011