From 5fdf60c698760eda387286d5885ffe67ee32191f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=CC=81=20R?= Date: Wed, 20 Dec 2017 08:18:49 +0100 Subject: [PATCH] [Cache] Skip class cache on PHP 7 like Symfony 3.x does by default On PHP 7 in combination with composer optimized aultoad, class cache does not provide any speed benefit anylonger. Only downsides like code breaking on interface changes when doing composer update or deploying new code on old cache. Addtional benefit whith this is for platform.sh where cache is currently placed on shared mount, meaning: - This change will likly speed up p.sh installs - Tiny bit less files on cache mount to clear - The issue mentioned above, given deployes shares cache will be avoided At least for class cache, there are still similar issues in rare cases on proxies generated for lazy services. --- web/app.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/app.php b/web/app.php index b8a2e86830..8ae8d95335 100644 --- a/web/app.php +++ b/web/app.php @@ -34,8 +34,9 @@ $kernel = new AppKernel($environment, $useDebugging); -// we don't want to use the classes cache if we are in a debug session -if (!$useDebugging) { +// we don't want to use the class cache if we are in a debug session +// Also not on PHP7+ where it does not give benefit (if using composer optimize autoload), only downsides remains +if (!$useDebugging && PHP_VERSION_ID < 70000) { $kernel->loadClassCache(); }