Enable bytecode invalidation with auto_reload

This commit is contained in:
Jérôme Tamarelle
2022-04-05 12:58:11 +02:00
parent 1dd5c10e73
commit ef8ae9cb61
2 changed files with 5 additions and 5 deletions
+4 -4
View File
@@ -329,11 +329,11 @@ If you iterate over a set of files, you can pass the filename to the
is enforced during template rendering (as Twig needs the context for some
checks like allowed methods on objects).
Refreshing modified Templates when OPcache or APC is enabled
------------------------------------------------------------
Refreshing modified Templates when OPcache is enabled
-----------------------------------------------------
When using OPcache with ``opcache.validate_timestamps`` set to ``0`` or APC
with ``apc.stat`` set to ``0`` and Twig cache enabled, clearing the template
When using OPcache with ``opcache.validate_timestamps`` set to ``0``,
Twig cache enabled and auto reload disabled, clearing the template
cache won't update the cache.
To get around this, force Twig to invalidate the bytecode cache::
+1 -1
View File
@@ -264,7 +264,7 @@ class Environment
{
if (\is_string($cache)) {
$this->originalCache = $cache;
$this->cache = new FilesystemCache($cache);
$this->cache = new FilesystemCache($cache, $this->autoReload ? FilesystemCache::FORCE_BYTECODE_INVALIDATION : 0);
} elseif (false === $cache) {
$this->originalCache = $cache;
$this->cache = new NullCache();