W3cubDocs

/Drupal 8

public function DrupalKernel::invalidateContainer

public DrupalKernel::invalidateContainer()

Invalidate the service container for the next request.

Overrides DrupalKernelInterface::invalidateContainer

File

core/lib/Drupal/Core/DrupalKernel.php, line 1069

Class

DrupalKernel
The DrupalKernel class is the core of Drupal itself.

Namespace

Drupal\Core

Code

public function invalidateContainer() {
  // An invalidated container needs a rebuild.
  $this->containerNeedsRebuild = TRUE;

  // If we have not yet booted, settings or bootstrap services might not yet
  // be available. In that case the container will not be loaded from cache
  // due to the above setting when the Kernel is booted.
  if (!$this->booted) {
    return;
  }

  // Also remove the container definition from the cache backend.
  $this->bootstrapContainer->get('cache.container')->deleteAll();
}

© 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!DrupalKernel.php/function/DrupalKernel::invalidateContainer/8.1.x