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

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

parent 4c82b7ea
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
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