Skip to content
Snippets Groups Projects
Verified Commit 41ac5c14 authored by Théodore Biadala's avatar Théodore Biadala
Browse files

Issue #3461860 by catch, smustgrave: More efficient route lookup caching

(cherry picked from commit da5f6215)
parent 62fb9199
No related branches found
No related tags found
2 merge requests!11185Issue #3477324 by andypost, alexpott: Fix usage of str_getcsv() and fgetcsv() for PHP 8.4,!9944Issue #3483353: Consider making the createCopy config action optionally fail...
Pipeline #238708 passed
Pipeline: drupal

#238711

    ...@@ -169,6 +169,9 @@ public function getRouteCollectionForRequest(Request $request) { ...@@ -169,6 +169,9 @@ public function getRouteCollectionForRequest(Request $request) {
    if ($cached = $this->cache->get($cid)) { if ($cached = $this->cache->get($cid)) {
    $this->currentPath->setPath($cached->data['path'], $request); $this->currentPath->setPath($cached->data['path'], $request);
    $request->query->replace($cached->data['query']); $request->query->replace($cached->data['query']);
    if ($cached->data['routes'] === FALSE) {
    return new RouteCollection();
    }
    return $cached->data['routes']; return $cached->data['routes'];
    } }
    else { else {
    ...@@ -183,7 +186,7 @@ public function getRouteCollectionForRequest(Request $request) { ...@@ -183,7 +186,7 @@ public function getRouteCollectionForRequest(Request $request) {
    $cache_value = [ $cache_value = [
    'path' => $path, 'path' => $path,
    'query' => $query_parameters, 'query' => $query_parameters,
    'routes' => $routes, 'routes' => $routes->count() === 0 ? FALSE : $routes,
    ]; ];
    $this->cache->set($cid, $cache_value, CacheBackendInterface::CACHE_PERMANENT, ['route_match']); $this->cache->set($cid, $cache_value, CacheBackendInterface::CACHE_PERMANENT, ['route_match']);
    return $routes; return $routes;
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment