You are here

protected function RouteProvider::getRouteCollectionCacheId in Drupal 8

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

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());

  // 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() . ':' . $request
    ->getQueryString();
}