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.

 

2) Clean cache types
Below command is used to cleans all cache type(s)

 

3) Disable cache types
Below command is used to disable all cache types

 

4) Eanble cache types
Below command is used to enable all cache types

 

5) Flush cache types
Below command is used to flushes cache storage used by all cache type(s)

 

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.

 

Additional information:
Magento2 provides a command “php bin/magento” to show all command line guide. The result will be like this:

 

Errors and solution:
[InvalidArgumentException]
There are no commands defined in the “cache” namespace.

Solution: Give full permission to “var/” folder then try command again.

 

[Magento\Framework\Exception\FileSystemException]
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.

 

Conclusion:
It comes to the end of tutorial: How to flush, clean, enable, disable and view status of Magento2 cache using backend and command line.

You can find Magento 2 pre-launch check list here

Thank you for reading this post!!!