fix: Use a more fitting cache key

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
pull/52793/head
Côme Chilliet 2025-05-13 17:15:38 +07:00
parent 01575b7d95
commit 5c9092bc5b
No known key found for this signature in database
GPG Key ID: A3E2F658B28C760A
1 changed files with 3 additions and 2 deletions

@ -73,11 +73,12 @@ class CachingRouter extends Router {
*/
public function findMatchingRoute(string $url): array {
$this->eventLogger->start('cacheroute:match');
$cachedRoutes = $this->cache->get('root:');
$key = $this->context->getHost() . '#' . $this->context->getBaseUrl() . '#rootCollection';
$cachedRoutes = $this->cache->get($key);
if (!$cachedRoutes) {
parent::loadRoutes();
$cachedRoutes = $this->serializeRouteCollection($this->root);
$this->cache->set('root:', $cachedRoutes, 3600);
$this->cache->set($key, $cachedRoutes, 3600);
}
$matcher = new CompiledUrlMatcher($cachedRoutes, $this->context);
$this->eventLogger->start('cacheroute:url:match');