You are here

protected function DrupalKernel::cacheDrupalContainer in Drupal 9

Same name and namespace in other branches
  1. 8 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 1340

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;
}