Magento 2 provides the functionality of caching the store to improve the performance of the e-commerce store. You can choose which cache type you want to enable. In the development phase, we suggest that you keep caching disabled. Whereas in production mode you should leverage caching for optimized speed.
Whenever you edit block, layout, page or configuration you should clear Magento cache. In this tutorial, we will guide you to clear the cache of your store. There are two ways to clear it:
- Cache Management from Admin Panel
- Cache Management using Command line
How to manage cache from Admin Dashboard?
Go to Dashboard = > System => Cache Management
To enable or disable cache type select cache type and click on drop-down above grid and choose the action –
To delete out-of-date items from the cache, you can clean or flush cache types:
Flush Magento Cache:
Cleaning a cache type deletes all the elements from enabled Magento cache types only. In other words, this option does not affect other processes or applications because it cleans only the cache that Magento uses.
Disabled cache types are not cleaned.
Flush Cache Storage:
Flushing a cache type erase the cache storage, which might affect other processes applications that are using the same storage.
How to manage cache from Command Line?
Managing cache is very easy and efficient using the command line.
To enable caching:
|php bin/magento cache:enable|
You can enable selected cache type by passing cache type as argument
|php bin/magento cache:enable layout|
To disable Caching:
|php bin/magento cache:disable|
Similar to enable command, if you want to delete particular cache type you can pass it as an argument to cache disable command:
|php bin/magento cache:disable config|
To clean cache from the command line:
|php bin/magento cache:clean|
To flush cache :
|php bin/magento cache:flush|
Hope this tutorial helps you to manage cache efficiently. Thanks for reading!