You are here

function _cacheflush_clear_preset in CacheFlush 7

Same name and namespace in other branches
  1. 7.3 cacheflush.api.inc \_cacheflush_clear_preset()
  2. 7.2 cacheflush.inc \_cacheflush_clear_preset()

Based on settings decide witch clear cache function to be called.

Parameters

int $preset_id: Preset id to do clear cache for.

2 string references to '_cacheflush_clear_preset'
cacheflush_cron_cronapi in cacheflush_cron/cacheflush_cron.module
Implements hook_cronapi().
cacheflush_menu in ./cacheflush.module
Implements hook_menu().

File

./cacheflush.inc, line 25
Cacheflusher module inc file with dinamic clear cache functions.

Code

function _cacheflush_clear_preset($preset_id) {

  // Get presets.
  $cache_presets = variable_get('cacheflush_preset_list', array());

  // Decide if is table or function and call specifed function to clear cache.
  foreach ($cache_presets[$preset_id]['#cacheflush_preset_values'] as $key => $value) {
    if ($value['is_table']) {
      _cacheflush_clear_preset_clear_table($key, $value);
    }
    else {
      _cacheflush_clear_preset_clear_call_functions($value);
    }
  }
  drupal_set_message(t("@name preset caches cleared.", array(
    '@name' => $cache_presets[$preset_id]['#name'],
  )));
  drupal_goto($_SERVER['HTTP_REFERER']);
}