How to correctly invalidate cache on production for Symfony2 application?

与世无争的帅哥 提交于 2019-12-03 16:31:57

问题


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?


回答1:


You missed env parameter: app/console cache:clear --env=prod --no-debug




回答2:


i believe you can try app/console cache:clear --no-warmup




回答3:


To clear the cache and instantly access the data my fix is

sudo app/console cache:clear --env=prod --no-warmup --no-debug

using this command turns off debug, and doesn't have a warmup time before the data is accessible again



来源:https://stackoverflow.com/questions/6994296/how-to-correctly-invalidate-cache-on-production-for-symfony2-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!