From b188fad8e84491b0631a7e33a28c55ccecbecaf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Thu, 12 Jun 2025 16:12:22 +0200 Subject: [PATCH] fix(router): In debug mode, cache routes only for 3 seconds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows testing a newly added or changed route in your application without having to wait 1 hour or bump the application version. Signed-off-by: Côme Chilliet --- lib/private/Route/CachingRouter.php | 2 +- lib/private/Route/Router.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/private/Route/CachingRouter.php b/lib/private/Route/CachingRouter.php index dbd5ef02603..becdb807f73 100644 --- a/lib/private/Route/CachingRouter.php +++ b/lib/private/Route/CachingRouter.php @@ -80,7 +80,7 @@ class CachingRouter extends Router { if (!$cachedRoutes) { parent::loadRoutes(); $cachedRoutes = $this->serializeRouteCollection($this->root); - $this->cache->set($key, $cachedRoutes, 3600); + $this->cache->set($key, $cachedRoutes, ($this->config->getSystemValueBool('debug') ? 3 : 3600)); } $matcher = new CompiledUrlMatcher($cachedRoutes, $this->context); $this->eventLogger->start('cacheroute:url:match', 'Symfony URL match call'); diff --git a/lib/private/Route/Router.php b/lib/private/Route/Router.php index 02f371e808a..22dfb21d4f3 100644 --- a/lib/private/Route/Router.php +++ b/lib/private/Route/Router.php @@ -53,7 +53,7 @@ class Router implements IRouter { public function __construct( protected LoggerInterface $logger, IRequest $request, - private IConfig $config, + protected IConfig $config, protected IEventLogger $eventLogger, private ContainerInterface $container, protected IAppManager $appManager,