如何正确使 Symfony2 应用程序的生产缓存失效?
我更改了应用程序的配置并将新代码部署到生产服务器。由于应用程序不解析配置文件并使用预编译的类,因此我需要更新缓存文件。
有 app/console cache:warmup
和 app/console cache:clear
命令。但调用这些命令后缓存并未更新,因此我必须手动删除 app/cache 文件夹。
手动删除是非常危险的操作,因为它不是原子的,所以我可以在请求期间删除部分缓存,这可能会导致致命错误。
我应该如何重新加载缓存?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您错过了
env
参数:app/console cache:clear --env=prod --no-debug
You missed
env
parameter:app/console cache:clear --env=prod --no-debug
我相信你可以尝试
应用程序/控制台缓存:clear --no-warmup
i believe you can try
app/console cache:clear --no-warmup
为了清除缓存并立即访问数据,我的修复方法是
使用此命令关闭调试,并且在再次访问数据之前没有预热时间
To clear the cache and instantly access the data my fix is
using this command turns off debug, and doesn't have a warmup time before the data is accessible again