如何正确使Symfony2应用程序生产中的缓存无效? [英] How to correctly invalidate cache on production for Symfony2 application?

查看:99
本文介绍了如何正确使Symfony2应用程序生产中的缓存无效?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我更改了应用程序的配置,并将新代码部署到了生产服务器。由于应用程序不解析配置文件并使用预编译的类,因此我需要更新缓存文件。

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.

app / console缓存:warmup app / console cache:clear 命令。但是调用这些命令后并没有更新缓存,因此我不得不手动删除app / cache文件夹。

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?

推荐答案

您错过了 env 参数:应用程序/控制台缓存:清除--env = prod --no -调试

这篇关于如何正确使Symfony2应用程序生产中的缓存无效?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆