function cache_actions_action_clear_cache in Cache Actions 6
Same name and namespace in other branches
- 6.2 cache_actions.rules.inc \cache_actions_action_clear_cache()
- 7.2 cache_actions.rules.inc \cache_actions_action_clear_cache()
- 7 cache_actions.rules.inc \cache_actions_action_clear_cache()
This action that clears all cache tables specified.
Parameters
$tables the tables to be cleared:
File
- ./
cache_actions.rules.inc, line 251 - This file provides the rules integration for this module. @author Fabian Sörqvist <fabian.sorqvist@gmail.com>
Code
function cache_actions_action_clear_cache($tables) {
$tables = explode(',', $tables);
// Fetch all available cache tables, so we can be sure that we don't remove data from a table that's not a cache.
$core = array(
'cache',
'cache_block',
'cache_filter',
'cache_page',
);
$cache_tables = array_merge(module_invoke_all('flush_caches'), $core);
foreach ($tables as $table) {
if (array_search($table, $cache_tables) !== FALSE) {
cache_clear_all('*', $table, TRUE);
}
}
}