New in Symfony 3.3: Deprecated cache clear with warmup
Symfony applications generate some cache files before running for the first time to improve their performance (for example to transform the Twig templates and the XML/YAML/Annotations configuration into PHP code).
These cached files are generated during a process called "cache warmup". Symfony
includes lots of "cache warmers" (for routing, templates, configuration, Doctrine,
etc.) and your application can define custom "cache warmers" by creating a class
and defining a service for it with the
Symfony's FrameworkBundle provides two commands to warmup the cache:
1 2 3 4 5 6 7 8
# warmup the existing cache but don't clear it $ ./bin/console cache:warmup (--env=prod|dev) # clear the existing cache and warm it up $ ./bin/console cache:clear (--env=prod|dev) # clear the existing cache but don't warm it up $ ./bin/console cache:clear --no-warmup (--env=prod|dev)
However, the warmup part of the
cache:clear command does not work well, and
does not deliver the guarantee that the generated cache is exactly the same as
the one that would have been generated via
Since one of the main goals of Symfony 4 is to be able to generate the full
cache to allow executing the application on read-only filesystems, we've decided
to deprecate the warmup part of
cache:clear in Symfony 3.3 and remove it
completely in Symfony 4.0.
In practice, this means that you should always add the
--no-warmup option to
cache:clear command and then execute
1 2 3 4 5 6
# before $ ./bin/console cache:clear (--env=prod|dev) # after $ ./bin/console cache:clear --no-warmup (--env=prod|dev) $ ./bin/console cache:warmup (--env=prod|dev)
Comments are closed.
To ensure that comments stay relevant, they are closed for old posts.