Tuesday, December 27, 2011

Clear cache programmatically in Drupal 7



This will reduce the work by going to performance settings page (admin/settings/performance) & clicking "cleared cached data" by scrolling down

But make sure that this page is only accessed by administrator

For Drupal 7 is same as Drupal 6

<?php
  drupal_flush_all_caches();
  drupal_set_message('cache flushed.');
?>

3 comments: