I have a very simple question. Which magento commands cause the removal of
var/cache/
var/generation/
var/di/
Folders and which bin/magento commands create them again.
-
You can prefer this answer for when you should run which commands: magento.stackexchange.com/a/184927/35758Prince Patel– Prince Patel2017年09月21日 12:59:41 +00:00Commented Sep 21, 2017 at 12:59
2 Answers 2
var/cache is cleared by php bin/magento cache:flush. It rebuilds on the fly as data is cached by Magento (there's no command to rebuild, it just happens).
var/di and var/generation are cleared by php bin/magento setup:upgrade, or manually (like executing rm -rf var/di var/generation from site root--be very careful with this!). You can rebuild them by running the command php bin/magento setup:di:compile. If you are in non-production mode, you can leave them and Magento will rebuild the generated sources on the fly (but it'll be a little slower while that happens).
must be php bin/magento cache:flush command