function DrupalKernel::cacheDrupalContainer

Same name in other branches
  1. 9 core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::cacheDrupalContainer()
  2. 10 core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::cacheDrupalContainer()
  3. 11.x core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::cacheDrupalContainer()

Stores the container definition in a cache.

Parameters

array $container_definition: The container definition to cache.

Return value

bool TRUE if the container was successfully cached.

1 call to DrupalKernel::cacheDrupalContainer()
DrupalKernel::initializeContainer in core/lib/Drupal/Core/DrupalKernel.php
Initializes the service container.
1 method overrides DrupalKernel::cacheDrupalContainer()
UpdateKernel::cacheDrupalContainer in core/lib/Drupal/Core/Update/UpdateKernel.php
Stores the container definition in a cache.

File

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

Class

DrupalKernel
The DrupalKernel class is the core of Drupal itself.

Namespace

Drupal\Core

Code

protected function cacheDrupalContainer(array $container_definition) {
    $saved = TRUE;
    try {
        $this->bootstrapContainer
            ->get('cache.container')
            ->set($this->getContainerCacheKey(), $container_definition);
    } catch (\Exception $e) {
        // There is no way to get from the Cache API if the cache set was
        // successful or not, hence an Exception is caught and the caller informed
        // about the error condition.
        $saved = FALSE;
    }
    return $saved;
}

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