How to flush cache is a common question when you guys using Magento2 store. Magento 2.1.3 has 13 cache types by default. All these 13 cache can be managed from store admin side itself. There are 5 simple commands to manage cache through command line aswell.
I) Manage cache from store admin side:
You can clean and flush cache types from store admin side below location. Go to below location and select all/required cache type then refresh.
admin-> System-> Tools-> Cache Management
II) Manage cache from commandline:
To run Magento commands you need to login to terminal and then go to your project root using below commands (assume your project name is ‘magento213’):
Xampp : cd /opt/lampp/htdocs/magento213
Ubuntu : cd /var/www/magento213
CentOS : cd /var/www/html/magento213
Windows : cd /d/xampp/htdocs/magento213
1) View the cache status.
Below command is used to checks all cache status.
php bin/magento cache:status
2) Clean cache types
Below command is used to cleans all cache type(s)
php bin/magento cache:clean
3) Disable cache types
Below command is used to disable all cache types
php bin/magento cache:disable
4) Eanble cache types
Below command is used to enable all cache types
php bin/magento cache:enable
5) Flush cache types
Below command is used to flushes cache storage used by all cache type(s)
php bin/magento cache:flush
Also you can manage single cache type by specifying its name in command. For example if you want to disable ‘customer_notification’ cache type then run below command in terminal.
php bin/magento cache:disable customer_notification
Errors and solution:
There are no commands defined in the “cache” namespace.
Solution: Give full permission to “var/” folder then try command again.
Deployment config file env.php is not writable.
Solution: give write permission (755 or 777) to the file “app/etc/env.php”. Later rollback this permission for security reason.
It comes to the end of tutorial: How to flush, clean, enable, disable and view status of Magento2 cache using backend and command line.
Thank you for reading this post!!!