Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(router): In debug mode, cache routes only for 3 seconds
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 <[email protected]>
  • Loading branch information
come-nc committed Jun 12, 2025
commit b188fad8e84491b0631a7e33a28c55ccecbecaf4
2 changes: 1 addition & 1 deletion lib/private/Route/CachingRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function findMatchingRoute(string $url): array {
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');
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Route/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading