W3cubDocs

/Drupal 8

public function ModuleHandler::resetImplementations

public ModuleHandler::resetImplementations()

Resets the cached list of hook implementations.

Overrides ModuleHandlerInterface::resetImplementations

File

core/lib/Drupal/Core/Extension/ModuleHandler.php, line 344

Class

ModuleHandler
Class that manages modules in a Drupal installation.

Namespace

Drupal\Core\Extension

Code

public function resetImplementations() {
  $this->implementations = NULL;
  $this->hookInfo = NULL;
  $this->alterFunctions = NULL;
  // 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
  // $this->cacheBackend->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
  // \Drupal::moduleHandler()->implementsHook() being called several thousand
  // times per request.
  $this->cacheBackend->set('module_implements', array());
  $this->cacheBackend->delete('hook_info');
}

© 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!lib!Drupal!Core!Extension!ModuleHandler.php/function/ModuleHandler::resetImplementations/8.1.x