diff --git a/includes/cache.inc b/includes/cache.inc
index 8666874..e690076 100644
--- a/includes/cache.inc
+++ b/includes/cache.inc
@@ -75,7 +75,7 @@ function cache_get_multiple(array &$cids, $bin = 'cache') {
  * might break functionality or are extremely expensive to recalculate. These
  * will be marked with a (*). The other bins expired automatically by core.
  * Contributed modules can add additional bins and get them expired
- * automatically by implementing hook_flush_caches().
+ * automatically by implementing hook_flush_cache_bins().
  *
  *  - cache: Generic cache storage bin (used for variables, theme registry,
  *  locale date, list of simpletest tests etc).
diff --git a/includes/common.inc b/includes/common.inc
index 4ec37dc..7a6af58 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -7134,10 +7134,15 @@ function drupal_flush_all_caches() {
   // Don't clear cache_form - in-progress form submissions may break.
   // Ordered so clearing the page cache will always be the last action.
   $core = array('cache', 'cache_filter', 'cache_bootstrap', 'cache_page');
-  $cache_tables = array_merge(module_invoke_all('flush_caches'), $core);
+  $cache_tables = array_merge(module_invoke_all('flush_cache_bins'), $core);
+  $cache_files = module_invoke_all('flush_cache_files');
+  module_invoke_all('flush_cache_execute', $cache_tables, $cache_files);
   foreach ($cache_tables as $table) {
     cache_clear_all('*', $table, TRUE);
   }
+  foreach ($cache_files as $file) {
+    file_delete($file);
+  }
 
   // Rebuild the bootstrap module list. We do this here so that developers
   // can get new hook_boot() implementations registered without having to
diff --git a/modules/block/block.module b/modules/block/block.module
index e0cb691..072c7cf 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -894,9 +894,16 @@ function _block_get_cache_id($block) {
 }
 
 /**
- * Implements hook_flush_caches().
+ * Implements hook_flush_cache_bins().
  */
-function block_flush_caches() {
+function block_flush_cache_bins() {
+  return array('cache_block');
+}
+
+/**
+ * Implements hook_flush_cache_execute().
+ */
+function block_flush_cache_execute($cache_bins, $cache_files) {
   // Rehash blocks for active themes. We don't use list_themes() here,
   // because if MAINTENANCE_MODE is defined it skips reading the database,
   // and we can't tell which themes are active.
@@ -904,8 +911,6 @@ function block_flush_caches() {
   foreach ($themes as $theme) {
     _block_rehash($theme->name);
   }
-
-  return array('cache_block');
 }
 
 /**
diff --git a/modules/field/field.module b/modules/field/field.module
index b808e59..377a1d6 100644
--- a/modules/field/field.module
+++ b/modules/field/field.module
@@ -306,9 +306,9 @@ define('FIELD_LOAD_REVISION', 'FIELD_LOAD_REVISION');
 class FieldUpdateForbiddenException extends FieldException {}
 
 /**
- * Implements hook_flush_caches().
+ * Implements hook_flush_cache_bins().
  */
-function field_flush_caches() {
+function field_flush_cache_bins() {
   return array('cache_field');
 }
 
diff --git a/modules/image/image.module b/modules/image/image.module
index 6ef43ad..40e0eeb 100644
--- a/modules/image/image.module
+++ b/modules/image/image.module
@@ -259,9 +259,9 @@ function image_system_file_system_settings_submit($form, &$form_state) {
 }
 
 /**
- * Implements hook_flush_caches().
+ * Implements hook_flush_cache_bins().
  */
-function image_flush_caches() {
+function image_flush_cache_bins() {
   return array('cache_image');
 }
 
diff --git a/modules/system/system.api.php b/modules/system/system.api.php
index 62c6a28..2cd64e5 100644
--- a/modules/system/system.api.php
+++ b/modules/system/system.api.php
@@ -2347,22 +2347,62 @@ function hook_mail($key, &$message, $params) {
 }
 
 /**
- * Add a list of cache tables to be cleared.
+ * Add a list of cache bins to be cleared.
  *
- * This hook allows your module to add cache table names to the list of cache
- * tables that will be cleared by the Clear button on the Performance page or
+ * This hook allows your module to add cache bin names to the list of cache
+ * bins that will be cleared by the Clear button on the Performance page or
  * whenever drupal_flush_all_caches is invoked.
  *
  * @return
- *   An array of cache table names.
+ *   An array of cache bin names.
  *
  * @see drupal_flush_all_caches()
  */
-function hook_flush_caches() {
+function hook_flush_cache_bins() {
   return array('cache_example');
 }
 
 /**
+ * Add a list of file objects to be cleared.
+ *
+ * This hook allows your module to add a list of file objects that will be
+ * cleared by the Clear button on the Performance page or whenever
+ * drupal_flush_all_caches is invoked.
+ *
+ * @return
+ *   An array of file objects.
+ *
+ * @see drupal_flush_all_caches()
+ */
+function hook_flush_cache_files() {
+  $file = file_load(1);
+  return array($file);
+}
+
+/**
+ * Perform necessary actions when the cache is cleared.
+ *
+ * This hook allows your module to perform actions when the Clear button on the
+ * Performance page is clicked or whenever drupal_flush_all_caches is invoked.
+ * This hook should be used whenver your module must perform actions other than
+ * clearing cache bins or removing files.
+ *
+ * @param $cache_bins
+ *   An array of cache bins to clear.
+ * @param $cache_files
+ *   An array of cached file objects to delete.
+ */
+function hook_flush_cache_execute($cache_bins, $cache_files) {
+  // Rehash blocks for active themes. We don't use list_themes() here,
+  // because if MAINTENANCE_MODE is defined it skips reading the database,
+  // and we can't tell which themes are active.
+  $themes = db_query("SELECT name FROM {system} WHERE type = 'theme' AND status = 1");
+  foreach ($themes as $theme) {
+    _block_rehash($theme->name);
+  }
+}
+
+/**
  * Perform necessary actions after modules are installed.
  *
  * This function differs from hook_install() in that it gives all other modules
diff --git a/modules/system/system.module b/modules/system/system.module
index 3ebc657..b981b44 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -2997,9 +2997,13 @@ function system_cron() {
   }
 
   $core = array('cache', 'cache_filter', 'cache_page', 'cache_form', 'cache_menu');
-  $cache_tables = array_merge(module_invoke_all('flush_caches'), $core);
-  foreach ($cache_tables as $table) {
-    cache_clear_all(NULL, $table);
+  $cache_bins = array_merge(module_invoke_all('flush_cache_bins'), $core);
+  $cache_files = module_invoke_all('flush_cache_files');
+  foreach ($cache_bins as $bin) {
+    cache_clear_all(NULL, $bin);
+  }
+  foreach ($cache_files as $file) {
+    file_delete($file);
   }
 
   // Cleanup the batch table and the queue for failed batches.
@@ -3022,9 +3026,9 @@ function system_cron() {
 }
 
 /**
- * Implements hook_flush_caches().
+ * Implements hook_flush_cache_bins().
  */
-function system_flush_caches() {
+function system_flush_cache_bins() {
   // Rebuild list of date formats.
   system_date_formats_rebuild();
   // Reset the menu static caches.
diff --git a/modules/update/update.module b/modules/update/update.module
index a2d705a..fc69456 100644
--- a/modules/update/update.module
+++ b/modules/update/update.module
@@ -831,7 +831,7 @@ function _update_cache_clear($cid = NULL, $wildcard = FALSE) {
 }
 
 /**
- * Implements hook_flush_caches().
+ * Implements hook_flush_cache_execute().
  *
  * Called from update.php (among others) to flush the caches.
  * Since we're running update.php, we are likely to install a new version of
@@ -846,11 +846,10 @@ function _update_cache_clear($cid = NULL, $wildcard = FALSE) {
  * check if the site is in MAINTENANCE_MODE == 'update' (which indicates
  * update.php is running, not update module... alas for overloaded names).
  */
-function update_flush_caches() {
+function update_flush_cache_execute($cache_bins, $cache_files) {
   if (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'update') {
     _update_cache_clear();
   }
-  return array();
 }
 
 /**
