1.20.x admin_bar.inc _admin_bar_flush_cache($name = NULL)

Flush all caches or a specific one.

Parameters

$name: (optional) Name of cache to flush.

See also

system_admin_bar_cache_info()

File

modules/admin_bar/admin_bar.inc, line 805
Menu builder functions for Administration bar.

Code

function _admin_bar_flush_cache($name = NULL) {
  switch ($name) {
    case 'admin_bar':
      cache('admin_bar')->flush();
      break;

    case 'menu':
      menu_rebuild();
      break;

    case 'cache':
      // Don't clear cache_form - in-progress form submissions may break.
      // Ordered so clearing the page cache will always be the last action.
      // @see backdrop_flush_all_caches()
      $core = array('cache', 'path', 'filter', 'bootstrap', 'token', 'page');
      $cache_bins = array_merge(module_invoke_all('flush_caches'), $core);
      foreach ($cache_bins as $bin) {
        cache($bin)->flush();
      }
      break;

    case 'assets':
      // Rebuild all color palettes.
      if (module_exists('color')) {
        color_rebuild_settings();
      }
      // Change query-strings on css/js files to enforce reload for all users.
      _backdrop_flush_css_js();

      backdrop_clear_css_cache();
      backdrop_clear_js_cache();

      // Clear the page cache, since cached HTML pages might link to old CSS and
      // JS aggregates.
      cache_clear_all('*', 'cache_page', TRUE);
      break;

    case 'theme':
      system_rebuild_theme_data();
      backdrop_theme_rebuild();
      break;

    case 'token':
      token_cache_clear();
      break;

    case 'layout':
      layout_reset_caches();
      break;
  }
}