Added caching for CP routes and other speed optimizations

This commit is contained in:
Pinga 2025-03-25 14:17:21 +02:00
parent d53f602122
commit 78c75afe99
4 changed files with 14 additions and 1 deletions

View file

@ -267,6 +267,12 @@ class ReportsController extends Controller
rmdir($dir->getRealPath());
}
}
// Clear Slim route cache if it exists
$routeCacheFile = $cacheDir . '/routes.php';
if (file_exists($routeCacheFile)) {
unlink($routeCacheFile);
}
} catch (Exception $e) {
$result = [
'success' => false,

View file

@ -22,3 +22,9 @@ foreach ($dirs as $dir) {
rmdir($dir->getRealPath());
}
}
// Clear Slim route cache if it exists
$routeCacheFile = $cacheDir . '/routes.php';
if (file_exists($routeCacheFile)) {
unlink($routeCacheFile);
}

View file

@ -48,6 +48,7 @@ $app = AppFactory::create();
$responseFactory = $app->getResponseFactory();
$routeCollector = $app->getRouteCollector();
$routeCollector->setCacheFile(__DIR__ . '/../cache/routes.php');
$routeCollector->setDefaultInvocationStrategy(new RequestResponseArgs());
$routeParser = $app->getRouteCollector()->getRouteParser();

View file

@ -386,4 +386,4 @@ $app->add(function (Psr\Http\Message\ServerRequestInterface $request, Psr\Http\S
}
});
$app->addErrorMiddleware(true, true, true);
$app->addErrorMiddleware(false, true, true);