W3cubDocs

/Drupal 8

function hook_cache_flush

hook_cache_flush()

Flush all persistent and static caches.

This hook asks your module to clear all of its 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.

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().

See also

drupal_flush_all_caches()

hook_rebuild()

Related topics

Hooks
Define functions that alter the behavior of Drupal core.

File

core/core.api.php, line 2139
Documentation landing page and topics, plus core library hooks.

Code

function hook_cache_flush() {
  if (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'update') {
    _update_cache_clear();
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!core.api.php/function/hook_cache_flush/8.1.x