Skip to content

Commit cdd7595

Browse files
committed
bug #57645 [Routing] Discard in-memory cache of routes when writing the file-based cache (mpdude)
This PR was merged into the 5.4 branch. Discussion ---------- [Routing] Discard in-memory cache of routes when writing the file-based cache | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #57640 | License | MIT The `Router` has a `private static ?array $cache` field that it uses to cache compiled route collections in the case that OpCache is not available to cache the file-based cache already. This is somewhat [a poor man's Opcache replacement](#57640 (comment)), useful e. g. for speedups during (functional) tests. `\Symfony\Component\Config\ResourceCheckerConfigCache::write` contains special code to make sure the OpCache will reload files after they have been written, but the `static` property kind of "hides" this feature. With this PR, the `static` cache entry is cleared as well. Commits ------- de7d884 [Router] Discard in-memory cache of routes when writing the file-based cache
2 parents 8dca45f + de7d884 commit cdd7595

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/Symfony/Component/Routing/Router.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ function (ConfigCacheInterface $cache) {
294294
}
295295

296296
$cache->write($dumper->dump(), $this->getRouteCollection()->getResources());
297+
unset(self::$cache[$cache->getPath()]);
297298
}
298299
);
299300

@@ -325,6 +326,7 @@ function (ConfigCacheInterface $cache) {
325326
$dumper = $this->getGeneratorDumperInstance();
326327

327328
$cache->write($dumper->dump(), $this->getRouteCollection()->getResources());
329+
unset(self::$cache[$cache->getPath()]);
328330
}
329331
);
330332

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy