Skip to main content

CODE TO CLEAR ALL CACHE

<?php
/*
* 2008 Jun 26
*
* The code submitted by dharmanerd in his comment probably
* works better than the original I had, so I've modified this
* to match his code.
*
* The original code for this was shamelessly yanked from
* `devel.module`; it was the function `devel_cache_clear()`.
*
*/

// only allow site administrators to visit this page:

if (!user_access('administer site configuration')) {
 
drupal_not_found();
}
else {
 
drupal_clear_css_cache();
 
$tables = array(
   
'cache',
   
'cache_content',
   
'cache_filter',
   
'cache_menu',
   
'cache_page',
   
'cache_views',
  );
  foreach (
$tables as $table) {
   
cache_clear_all('*', $table, TRUE);
  }
 
drupal_set_message('Cache cleared.');
 
drupal_goto();
}

?>

Ref: http://drupal.org/node/152983