function RouteProvider::getRouteCollectionCacheId

Same name in other branches
  1. 9 core/lib/Drupal/Core/Routing/RouteProvider.php \Drupal\Core\Routing\RouteProvider::getRouteCollectionCacheId()
  2. 8.9.x core/lib/Drupal/Core/Routing/RouteProvider.php \Drupal\Core\Routing\RouteProvider::getRouteCollectionCacheId()
  3. 11.x core/lib/Drupal/Core/Routing/RouteProvider.php \Drupal\Core\Routing\RouteProvider::getRouteCollectionCacheId()

Returns the cache ID for the route collection cache.

Parameters

\Symfony\Component\HttpFoundation\Request $request: The request object.

Return value

string The cache ID.

1 call to RouteProvider::getRouteCollectionCacheId()
RouteProvider::getRouteCollectionForRequest in core/lib/Drupal/Core/Routing/RouteProvider.php
Finds routes that may potentially match the request.

File

core/lib/Drupal/Core/Routing/RouteProvider.php, line 450

Class

RouteProvider
A Route Provider front-end for all Drupal-stored routes.

Namespace

Drupal\Core\Routing

Code

protected function getRouteCollectionCacheId(Request $request) {
    // Include the current language code in the cache identifier as
    // the language information can be elsewhere than in the path, for example
    // based on the domain.
    $this->addExtraCacheKeyPart('language', $this->getCurrentLanguageCacheIdPart());
    $this->addExtraCacheKeyPart('query_parameters', $this->getQueryParametersCacheIdPart($request));
    // Sort the cache key parts by their provider in order to have predictable
    // cache keys.
    ksort($this->extraCacheKeyParts);
    $key_parts = [];
    foreach ($this->extraCacheKeyParts as $provider => $key_part) {
        $key_parts[] = '[' . $provider . ']=' . $key_part;
    }
    return 'route:' . implode(':', $key_parts) . ':' . $request->getPathInfo();
}

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