Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. RouteProvider.php

function 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 453

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal