Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
533 views
in Technique[技术] by (71.8m points)

php - Clear cache in Symfony: `cache:clear` or `rm -rf`?

Which is the difference between ./bin/console cache:clear --env=prod and rm -rf var/cache/prod/*? Console command is very slow. Bash command is fast. So, ... why use cache:clear instead of rm?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

cache:clear wipes previously created cache items, but also, it does a cache warm-up. Upon this, you application should load very fast due to the fact that cache was already pre-populated.

On the other hand, rm -rf does only one part of the job. You should notice performance impact when you try to load you app the first time after this.

I would also like to point out another thing: permissions. If you are logged in as root for example, and you did not set access rights via setfacl (or any other method), cache:clear will most probably create your cache items owned by root. This could be an issue, down the line.

Hope this helps a bit...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...