Manually Clear Cached Data

Posted on March 22, 2013

ExpressionEngine have good caching feature. You can see about Data Caching and Performance. The cached data can be cleared from ExpressionEngine’s Control Panel -> Tools -> Data -> Clear Caching. Here you can see the options to clear different cached data.

Clear Cached data

Also, there is a plugin Cron-Clean-Cache which works with Cron plugin to clear the cache. But I don’t think if you would like to schedule CRON at server end by calling an URL, it would work. There is a simple way just by having this code (for ExpressionEngine v2.+):


$this->EE =& get_instance();
$cache_type = 'all'; // It can be 'page' OR 'tag' OR 'db' OR 'sql' OR 'relationships'
$this->EE->functions->clear_caching($cache_type, '', TRUE);

You can have this code within a template (PHP enabled) OR create a plugin and call the plugin tag within template OR create a module with action id which will set an URL like http://www.examplesite.com/?ACT=123. You can schedule the CRON with that specific URL which will clear the cache periodically.