1.20.x module.inc module_implements_reset()

Regenerate the stored list of hook implementations.

Related topics

File

includes/module.inc, line 829
API for loading and interacting with Backdrop modules.

Code

function module_implements_reset() {
  // We maintain a persistent cache of hook implementations in addition to the
  // static cache to avoid looping through every module and every hook on each
  // request. Benchmarks show that the benefit of this caching outweighs the
  // additional database hit even when using the default database caching
  // backend and only a small number of modules are enabled. The cost of the
  // cache('bootstrap')->get() is more or less constant and reduced further when
  // non-database caching backends are used, so there will be more significant
  // gains when a large number of modules are installed or hooks invoked, since
  // this can quickly lead to module_hook() being called several thousand times
  // per request.
  backdrop_static_reset('module_implements');
  cache('bootstrap')->set('module_implements', array());
  backdrop_static_reset('module_hook_info');
  backdrop_static_reset('backdrop_alter');
  cache('bootstrap')->delete('hook_info');
}