如何正确使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 -调试