function DrupalKernel::getContainerFromCacheIfCacheable

Gets the cached container definition if the cache may be used.

Return value

array|null The cached container definition, or NULL if the cache must not be used or holds no definition.

2 calls to DrupalKernel::getContainerFromCacheIfCacheable()
DrupalKernel::initializeContainer in core/lib/Drupal/Core/DrupalKernel.php
Initializes the service container.
KernelTestDrupalKernel::getContainerFromCacheIfCacheable in core/lib/Drupal/Core/Test/KernelTestDrupalKernel.php
Gets the cached container definition if the cache may be used.
1 method overrides DrupalKernel::getContainerFromCacheIfCacheable()
KernelTestDrupalKernel::getContainerFromCacheIfCacheable in core/lib/Drupal/Core/Test/KernelTestDrupalKernel.php
Gets the cached container definition if the cache may be used.

File

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

Class

DrupalKernel
The DrupalKernel class is the core of Drupal itself.

Namespace

Drupal\Core

Code

protected function getContainerFromCacheIfCacheable() : ?array {
  // If the module list hasn't already been set in updateModules and we are
  // not forcing a rebuild, then try and load the container from the cache.
  if (!$this->moduleList && !$this->containerNeedsRebuild) {
    return $this->getCachedContainerDefinition();
  }
  return NULL;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.