What is Flush Magento Cache?

What is Flush Magento Cache?

Magento caches are stored pages to improve loading speed. A cache stores data so that requests for that data are served quickly. That way, users can rapidly access storefront content & enhance user experience.

Magento includes many cache types from layout to block HTML layout. There are full-page caches and many more.

However, the updates made on website content may not reflect on the browser. The cache has to be refreshed for the changes to be seen on the front end.

You also have to purge the cache to clear out-of-date resources. That way, you don’t wait for the cache expiry date to upload the new website changes.

In this article, we cover the Flush Magento cache and how to clear cache in Magento.

What is Flush Magento Cache?

What is Flush Magento Cache? - Magento 2 Cache Management

Magento Cache Management displays the primary cache with its associated tag. You can see large buttons on the upper right of the page to flush cache.

Flush Magento Cache is a feature to clear cache from the cache storage. It removes items in the default Commerce cache (var/cache). The items are cleared based on their associated Commerce tags.

Adobe recommends enabling flush cache actions only for admins. Limit the access levels for effective caching.

How to Flush Magento Cache

How to Flush Magento Cache - Magento 2 Cache Management

You can Flush Magento Cache in two simple ways. By using the Admin panel or the command line.

From the Admin Panel, go to Magento Admin Cache Management:

  • Go to System > Cache Management
  • Press the orange button on the top right: Flush Magento Cache

Using the Command Line:

The other way to flush the Magento cache is using the Command Line:

  • Navigate to Magento 2 Root Directory
  • Access Flush Cache Storage: php bin/magento cache:clean
  • Flush Magento Cache: php bin/magento cache:flush
  • Save the changes. Check the results for entries that Magento caches.

Difference between Magento Caches

Difference between Flush Magento Cache vs. Flush Cache Storage vs. Clean Cache

  • Flush Magento Cache

Flush Magento caching refreshes cache on the backend. It removes the caches with Magento tags.

The items in the default Commerce cache are removed based on their tags.

  • Flush Cache Storage

Refreshes the cache of all Magento stores, regardless of Commerce tag. All Magento stores sharing the cache storage will have cleared the cache.

The cached files used by other applications are removed in the process. It may affect other processes that run the same cache storage.

For example, other online stores and applications.

  • Clean Cache

Cleaning a cache type deletes the enabled Magento cache types. It does not delete the items which are stored in the cache without proper tags.

The Clean cache doesn’t affect other applications or processes. Because it only cleans the cache that Magento uses. The disabled cache types are not cleaned.

Additional Magento Cache Features

At the bottom of the page, you get additional Cache management buttons. It includes primary buttons:

  • Flush Catalog Images Cache
    It clears all the catalog images that are automatically watermarked & resized. The images are stored at- media/catalog/product/cache
    If recently uploaded images are not shown in the catalog, try flushing the catalog and refreshing the browser.

  • Flush JavaScript/CSS Cache
    It clears merged JS and CSS files from the cache location.
    If the JS changes are not displayed in the store, try flushing the JS/CSS cache & refreshing the browser.

  • Flush Static Files Cache - It clears any pre-processed view files and static files from the cache.

How to Enable/Disable Magento Cache Types?

There are two easy ways you can enable & disable Magento cache types.

From the Admin Panel:

  • In Magento 2 Backend, go to System > Tools > Cache Management.

How to Enable/Disable Magento 2 Cache Types

  • Select the box on the cache type you want to Enable/Disable.

How to Enable/Disable Magento 2 Cache Types

  • Then on the top left corner, select Enable/Disable or Refresh options.

How to Enable/Disable Magento 2 Cache Types

  • Click on the Submit button.

Clear Cache Using the Command Line-

Magento 2 lets you clear cache using the command line. To clear Magento 2 cache, use the following commands:

  • To enable the cache: php bin/magento cache:enable

  • To disable the cache: php bin/magento cache:disable

  • To flush the Magento 2 cache via command line: php bin/magento cache:flush

  • To clean the cache in the website: php bin/magento cache:clean

To clear certain cache types, you have to specify the types. For example: config, layout, block_html, collections, reflection, db_ddl, eav. These are comma-separated.

Magento 2 Cache Types and Associated Tags

Cache Type Description Associated Tag
Configuration The XML configurations are collected across modules and merged.

The config webservice has store-specific settings stored in the file system and database.

config.xml, local.xml - System. Config.xml - Module
CONFIG
Layouts Instructions for building layouts.

Clean or flush the cache type after you modify layout files.
LAYOUT_GENERAL_CACHE_TAG
Block HTML Output Page blocks HTML.Clean or flush the cache type when you modify the view layer. BLOCK_HTML
Collections Data Database queries results. Adobe Commerce cleans this cache automatically.

There may be third-party data cached that has to be cleared.
COLLECTION_DATA
Database DDL operations Database schema. It is cleared automatically.

However, third-party data cache status has to be cleared manually.

Clear the cache if you make changes to the database schema.
DB_DDL
Compiled Config These are the results of code compilation. COMPILED_CONFIG
EAV types and attributes These are metadata related to EAV attributes.

It is an entity-type declaration cache. Typically you should not clear this cache type.
EAV
Page Cache Allows full page caching.

Clean or flush this cache type for code-level changes that affect HTML output.

Keep the cache enabled as HTML caching improves site performance.
FPC
Translations Translation files. After merging translations from modules, the cache is cleared. TRANSLATE
Integration Configuration Compiled integrations. Clean or flush this cache after changing or adding integrations. INTEGRATION
Target Rule Target Rule Index data. TARGET_RULE
Integration API configuration Compiled integration APIs configuration of the Store’s Integrations. INTEGRATION_API_CONFIG

Code:config_integration_api

Conclusion

Magento collects configuration from modules & merges it into cache. Whenever a cache has to be refreshed, you will receive a notice on the admin panel.

From the cache management dashboard, you can enable, disable and refresh the cache types.

The article covered the steps to enable & disable cache types. We also discussed Magento flush cache & how it differs from other caching.

Magento recommends flushing cache after installing extensions.

During flushing cache, consider the cache type & tags. Schedule the flushing during non-peak hours. As clearing cache during peak times can cause high load.

Ensure that the right access levels are granted to admins for effective caching.

To learn more about the Magento platform, check out the MGT Commerce blog.

Nikita S.
Nikita S.
Technical Writer

As a professional content writer, Nikita S. is experienced in crafting well-researched articles that simplify complex information and promote technical communication. She is enthusiastic about cloud computing and holds a specialization in digital marketing.


Get the fastest Magento Hosting! Get Started