Skip to content

Commit 86ca33a

Browse files
authored
Merge pull request #295 from FriendsOfSymfony/pestaa-httpcache-docs
Updated Symfony HTTP cache docs
2 parents f24648b + 00bae2e commit 86ca33a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Resources/doc/features/symfony-http-cache.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,26 @@ To register subscribers that you need to instantiate yourself, overwrite
7676
return $subscribers;
7777
}
7878

79+
.. warning::
80+
81+
Since Symfony 2.8, the class cache (``classes.php``) is compiled even in
82+
console mode by an optional warmer (``ClassCacheCacheWarmer``). This can
83+
produce conflicting results with the regular web entry points, because the
84+
class cache may contain definitions (such as the subscribers above) that
85+
are loaded before the class cache itself; leading to redeclaration fatal
86+
errors.
87+
88+
There are two workarounds:
89+
90+
* Disable class cache warming in console mode with e.g. a compiler pass::
91+
92+
$container->getDefinition('kernel.class_cache.cache_warmer')->clearTag('kernel.cache_warmer');
93+
94+
* Force loading of all classes and interfaced used by the ``HttpCache`` in
95+
``app/console`` to make the class cache omit those classes. The simplest
96+
way to achieve this is to call ``class_exists`` resp. ``interface_exists``
97+
with each of them.
98+
7999
Subscribers
80100
~~~~~~~~~~~
81101

0 commit comments

Comments
 (0)