Cache types in Magento 2

Cache types in Magento 2 – As we can see, there are 13 cache types in “System -> Cache Management”. In this post, let’s find out what they are used for and when we need to flush each type.

1. Configuration

  • Code: config
  • Description: Magento collects configuration from all modules, merges it, and saves the merged result to the cache.
  • When need to flush: Clean or flush this cache type after modifying configuration files.

2. Layout

  • Code: layout
  • Description: Compiled page layouts, layout components from all components.
  • When need to flush: Clean or flush this cache type after modifying layout files.

3. Block HTML output

  • Code: block_html
  • Description: HTML cache for block.
  • When need to flush: Clean or flush this cache type after modifying the view layer.

4. Collection Data

  • Code: collections
  • Description: Results of database queries. If necessary, Magento cleans up this cache automatically, but third-party developers can put any data in any segment of the cache.
  • When need to flush: Clean or flush this cache type if your custom module uses logic that results in cache entries that Magento cannot clean.

5. DDL

  • Code: db_ddl
  • Description: Database schema. If necessary, Magento cleans up this cache automatically, but third-party developers can put any data in any segment of the cache.
  • When need to flush: Clean or flush this cache type after you make custom changes to the database schema.

6. Entity Attribute Value (EAV)

  • Code: eav
  • Description: Metadata related to EAV attributes
  • When need to flush: You should not typically need to clean or flush this cache type.

7. Page cache

  • Code: full_page
  • Description: Cache for generated HTML pages.
  • When need to flush: Clean or flush this cache type after modifying code level that affects HTML output. It’s recommended to keep this cache enabled because caching HTML improves performance significantly.

8. Reflection

  • Code: reflection
  • Description: Removes a dependency between the Webapi module and the Customer module.

9. Translations

  • Code: tranlsate
  • Description: Merged translations from all modules
  • When need to flush: Flush this cache type when you edit translate files.

10. Integration configuration

  • Code: config_integration
  • Description: Compiled integrations.
  • When need to flush: Clean or flush this cache after changing or adding integrations

11. Integration API configuration

  • Code: config_integration_api
  • Description: Compiled integration APIs
  • When need to flush: Clean or flush this cache after changing or adding integrations API

12. Web services configuration

  • Code: config_webservice
  • Description: Cache for Web API structure.
  • When need to flush: Clean or flush this cache after changing or adding Web API.

That’s all default cache types in Magento 2. 

One thought on “Cache types in Magento 2

Leave a Reply

Your email address will not be published.