mirror of
https://github.com/getnamingo/registry.git
synced 2025-08-15 13:53:50 +02:00
Added caching for CP routes and other speed optimizations
This commit is contained in:
parent
d53f602122
commit
78c75afe99
4 changed files with 14 additions and 1 deletions
|
@ -267,6 +267,12 @@ class ReportsController extends Controller
|
||||||
rmdir($dir->getRealPath());
|
rmdir($dir->getRealPath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clear Slim route cache if it exists
|
||||||
|
$routeCacheFile = $cacheDir . '/routes.php';
|
||||||
|
if (file_exists($routeCacheFile)) {
|
||||||
|
unlink($routeCacheFile);
|
||||||
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$result = [
|
$result = [
|
||||||
'success' => false,
|
'success' => false,
|
||||||
|
|
|
@ -22,3 +22,9 @@ foreach ($dirs as $dir) {
|
||||||
rmdir($dir->getRealPath());
|
rmdir($dir->getRealPath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clear Slim route cache if it exists
|
||||||
|
$routeCacheFile = $cacheDir . '/routes.php';
|
||||||
|
if (file_exists($routeCacheFile)) {
|
||||||
|
unlink($routeCacheFile);
|
||||||
|
}
|
|
@ -48,6 +48,7 @@ $app = AppFactory::create();
|
||||||
$responseFactory = $app->getResponseFactory();
|
$responseFactory = $app->getResponseFactory();
|
||||||
|
|
||||||
$routeCollector = $app->getRouteCollector();
|
$routeCollector = $app->getRouteCollector();
|
||||||
|
$routeCollector->setCacheFile(__DIR__ . '/../cache/routes.php');
|
||||||
$routeCollector->setDefaultInvocationStrategy(new RequestResponseArgs());
|
$routeCollector->setDefaultInvocationStrategy(new RequestResponseArgs());
|
||||||
$routeParser = $app->getRouteCollector()->getRouteParser();
|
$routeParser = $app->getRouteCollector()->getRouteParser();
|
||||||
|
|
||||||
|
|
|
@ -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);
|
Loading…
Add table
Add a link
Reference in a new issue