8000 [HttpKernel] dont check cache freshness more than once per process · symfony/http-kernel@354bcae · GitHub
[go: up one dir, main page]

Skip to content

Commit 354bcae

Browse files
[HttpKernel] dont check cache freshness more than once per process
1 parent e54578d commit 354bcae

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Kernel.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
7474
private $requestStackSize = 0;
7575
private $resetServices = false;
7676

77+
private static $freshCache = [];
78+
7779
const VERSION = '4.4.0-DEV';
7880
const VERSION_ID = 40400;
7981
const MAJOR_VERSION = 4;
@@ -511,7 +513,9 @@ protected function initializeContainer()
511513
$errorLevel = error_reporting(\E_ALL ^ \E_WARNING);
512514

513515
try {
514-
if (file_exists($cachePath) && \is_object($this->container = include $cachePath) && (!$this->debug || $cache->isFresh())) {
516+
if (file_exists($cachePath) && \is_object($this->container = include $cachePath)
517+
&& (!$this->debug || (self::$freshCache[$k = $cachePath.'.'.$this->environment] ?? self::$freshCache[$k] = $cache->isFresh()))
518+
) {
515519
$this->container->set('kernel', $this);
516520
error_reporting($errorLevel);
517521

0 commit comments

Comments
 (0)
0