[英]How should I do to clean up the symfony2 cache
I'm a website administrator,my site were build on symfony2 freamwork. 我是网站管理员,我的网站建立在symfony2框架上。 My site has a lot of users.When I clear the cache,a few users are accessing my website,so I can not quite put clean cache that caused a lot of problems.
我的网站上有很多用户。当我清除缓存时,有几个用户正在访问我的网站,因此我不能完全清除干净的缓存,这会引起很多问题。 How should I do to clean up the cache?
我应该如何清理缓存?
To clear the cache in symfony you need to execute the following command : 要清除symfony中的缓存,您需要执行以下命令:
php app/console cache:clear --env=prod
the --env=prod
tells the console
to execute in the production environment. --env=prod
告诉console
在生产环境中执行。 This will remove the previous cache. 这将删除先前的缓存。
Note: 注意:
By default Symfony will store session information in its cache directory. 默认情况下,Symfony将会话信息存储在其缓存目录中。 Clearing the cache will mean that every user has to re-authenticate.
清除缓存将意味着每个用户都必须重新进行身份验证。
You can change the path that Symfony uses to store the session files by changing the following line in the app/config/config.yml
. 您可以通过更改
app/config/config.yml
的以下行来更改Symfony用于存储会话文件的路径。
framework:
session:
save_path: %kernel.root_dir%/sessions
The save_path
setting will then store session information in app/sessions
. 然后
save_path
设置将会话信息存储在app/sessions
。
I had faced this problem multiple times. 我已经多次面对这个问题。 If your website was accessing by so many user and you clear the cache.
如果您的网站被这么多用户访问,并且您清除了缓存。 i am sure your website was down for couple for minutes until the new cache generated.
我确定您的网站已经关闭了几分钟,直到生成新的缓存。
So clear cache on production server should not be a regular activity. 因此,在生产服务器上清除缓存不应该是常规活动。 There are couple of solution or tricks to overcome from this problem:
有两个解决方案或技巧可以解决此问题:
how to clear the cache 如何清除缓存
php app/console cache:clear
chmod -R 777 app/cache
chmod -R 777 app/logs
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.