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
Loading
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -169,6 +169,9 @@ public function getRouteCollectionForRequest(Request $request) {
    if ($cached = $this->cache->get($cid)) {
      $this->currentPath->setPath($cached->data['path'], $request);
      $request->query->replace($cached->data['query']);
      if ($cached->data['routes'] === FALSE) {
        return new RouteCollection();
      }
      return $cached->data['routes'];
    }
    else {
@@ -183,7 +186,7 @@ public function getRouteCollectionForRequest(Request $request) {
      $cache_value = [
        'path' => $path,
        'query' => $query_parameters,
        'routes' => $routes,
        'routes' => $routes->count() === 0 ? FALSE : $routes,
      ];
      $this->cache->set($cid, $cache_value, CacheBackendInterface::CACHE_PERMANENT, ['route_match']);
      return $routes;