I'm a website administrator,my site were build on symfony2 freamwork. 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 :
php app/console cache:clear --env=prod
the --env=prod
tells the console
to execute in the production environment. This will remove the previous cache.
Note:
By default Symfony will store session information in its cache directory. 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
.
framework:
session:
save_path: %kernel.root_dir%/sessions
The save_path
setting will then store session information in 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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.