function hook_cache_flush

Flush all persistent and static caches.

This hook asks your module to clear all of its persistent (database) and static caches, in order to ensure a clean environment for subsequently invoked data rebuilds.

Do NOT use this hook for rebuilding information. Only use it to flush custom caches and return the names of additional cache bins to flush.

Static caches using drupal_static() do not need to be reset manually. However, all other static variables that do not use drupal_static() must be manually reset.

This hook is invoked by drupal_flush_all_caches(). It runs before module data is updated and before hook_rebuild().

Return value

array An array of cache bins to be flushed.

See also

drupal_flush_all_caches()

hook_rebuild()

Related topics

9 functions implement hook_cache_flush()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

block_cache_flush in drupal/core/modules/block/block.module
Implements hook_cache_flush().
config_test_cache_flush in drupal/core/modules/config/tests/config_test/config_test.module
Implements hook_cache_flush().
field_cache_flush in drupal/core/modules/field/field.module
Implements hook_cache_flush().
filter_cache_flush in drupal/core/modules/filter/filter.module
Implements hook_cache_flush().
system_cache_flush in drupal/core/modules/system/system.module
Implements hook_cache_flush().

... See full list

3 invocations of hook_cache_flush()
ClearTest::testFlushAllCaches in drupal/core/modules/system/lib/Drupal/system/Tests/Cache/ClearTest.php
Tests drupal_flush_all_caches().
drupal_flush_all_caches in drupal/core/includes/common.inc
Flushes all persistent caches, resets all variables, and rebuilds all data structures.
system_cron in drupal/core/modules/system/system.module
Implements hook_cron().

File

drupal/core/modules/system/system.api.php, line 2128
Hooks provided by Drupal core and the System module.

Code

function hook_cache_flush() {
  return array(
    'example',
  );
}