function DrupalKernel::getContainerCacheKey

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

Returns the container cache key based on the environment.

The 'environment' consists of:

  • The kernel environment string.
  • The Drupal version constant.
  • The deployment identifier from settings.php. This allows custom deployments to force a container rebuild.
  • The operating system running PHP. This allows compiler passes to optimize services for different operating systems.
  • The paths to any additional container YAMLs from settings.php.

Return value

string The cache key used for the service container.

2 calls to DrupalKernel::getContainerCacheKey()
DrupalKernel::cacheDrupalContainer in core/lib/Drupal/Core/DrupalKernel.php
Stores the container definition in a cache.
DrupalKernel::getCachedContainerDefinition in core/lib/Drupal/Core/DrupalKernel.php
Returns the cached container definition - if any.

File

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

Class

DrupalKernel
The DrupalKernel class is the core of Drupal itself.

Namespace

Drupal\Core

Code

protected function getContainerCacheKey() {
    $parts = [
        'service_container',
        $this->environment,
        \Drupal::VERSION,
        Settings::get('deployment_identifier'),
        PHP_OS,
        serialize(Settings::get('container_yamls')),
    ];
    return implode(':', $parts);
}

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