I changed the configuration of the application and deployed the new code to production server. Since the application does not parse the configuration files and use precompiled classes I needed to update the cache files.
There is app/console cache:warmup
and app/console cache:clear
commands. But the cache wasn't updated after invoking these commands, so I had to delete the app/cache folder manually.
Manual deletion is very dangerous operation because it's not atomic so I can remove part of cache during request and this may lead to fatal error.
How should I reload cache?
The most basic kind of invalidation is direct items deletion. But when the state of a primary resource has spread across several cached items, keeping them in sync can be difficult. The Symfony Cache component provides two mechanisms to help solve this problem: Expiration based invalidation for time-related dependencies.
Later, when the item is retrieved, Symfony stores the item automatically in all the missing pools. In applications with many cache keys it could be useful to organize the data stored to be able to invalidate the cache more efficiently. One way to achieve that is to use cache tags.
During application development, you have to clear the cache in various situations: When you create a new class: Adding a class to an autoloading directory (one of the project’s lib/ folders) is not enough to have symfony find it automatically.
To get the best of both worlds you may use a chain of adapters. A cache chain combines several cache pools into a single one. When storing an item in a cache chain, Symfony stores it in all pools sequentially. When retrieving an item, Symfony tries to get it from the first pool.
You missed env
parameter: app/console cache:clear --env=prod --no-debug
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With