Magento 2 Cache Type and how to clear cache in Magento 2

Magento 2 comes with advance Cache management in order to handle best performance optimization.

How to clear cache in Magento 2

Clear cache from admin section:

  • Login to admin section
  • Click on System (gear shape icon)
  • Click on Flush magento Cache button near top right
  • Select cache type and click on flush button

Clear cache from command line

php bin/magento cache:flush

Types of Cache in Magento 2

There are 12 different kind of cache in magento 2.

Friendly name Type name Description
Configuration config Magento 2 collects configuration from all modules, merges it, and saves the merged result to the cache including store configuration.
Layout layout Its compiled page layout. It contains layout from all the components
Block HTML output block_html HTML page fragments per block from all the modules
Collections data collections Results of database queries
DDL db_ddl Database schema
Entity attribute value (EAV) eav Value of eav attributes (store labels, links to related PHP code, attribute rendering, search settings)
Page cache full_page Generated HTML pages
Reflection reflection Removes a dependency between the Webapi module and the Customer module.
Translations translate Merged translations from all the modules
Integration configuration config_integration Compiled integrations(Clean or flush this cache after changing or adding integrations.)
Integration API configuration config_integration_api Compiled integration API
Web services configuration config_webservice Webservice API structure

Enable/Disable cache in Magento 2

You can enable/disable any of the cache at any moment. The command for disabling/enabling specific cache is

php bin/magent cache:enable –TYPENAME—

if you omit the typename then by default it will enable/disable all the modules.

Flushing specific type of cache

You can flush any specific type of cache. The meaning of flush is purges the cache storage. Which might affect other processes applications that are using the same storage. The command to flush magento storage is

bin/magento cache:flush –TYPENAME—

Omitting the typename flush all the cache types.

Clean specific type of cache

Cleaning a cache type deletes all items from enabled Magento cache type. 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.

php bin/magento cache:clean –TYPENAME—

Omitting the type name clean all the cache types.

The following two tabs change content below.

Chandra Shekhar

GCP Architect
Chandra Shekhar Pandey is Google certified Cloud engineer, I am Magento2 Trained developer. Having huge experience in designing cloud solution. I have around 12 years of experience with world enterprise IT companies and fortune 500 clients. During my architecture design I am always caring about high availability, fast performance and resilient system. From the programmer background I have huge experience in LAMP stack as well. Throughout my carrier I have worked on Retail, E-Learning, Video Conferencing and social media domain. The motive of creating cutehits was just to share the knowledge/solutions I get to know during my day to day life so that if possible I can help someone for same problems/solutions. CuteHits.com is a really a very effort for sharing knowledge to rest of the world. For any query/suggestion about same you can contact me on below details:- Email: shekharmca2005 at gmail.com Phone: +91-9560201363

Latest posts by Chandra Shekhar (see all)

You may also like...