How to Clear Magento 2 Cache

How to Clear Magento 2 Cache

Cache is a particular area of your hosting server. It helps to increase the page load speed by storing the web pages through browsers. Also, it reduces resource requirements in the situation of heavy traffic.

The basic advantage of using cache is faster performance. If you are unsure of why the changes made on the website don’t reflect, the very first step you should try is to¬†refresh the cache to reflect those changes in the frontend.

Everyone wants the fastest way to delete cache in Magento 2! Here are the three methods for Magento 2 Clear Cache which might prove useful to you ūüôā

Read about:

  1. Clear Magento 2 cache via admin panel
  2. Clear Magento 2 cache via command line
  3. Clear Magento 2 cache programmatically
  4. Full Page Cache
  5. Difference between Magento 2 cache clean and cache flush
  6. Method to enable cache types

Method 1: Clear Magento 2 Cache via Admin Panel

  • Navigate to Admin Panel > System > Cache Management
  • Define the cache types that is to be refreshed
  • Select the Cache Type blocks that are assigned Invalidated status. You may select “All” if you don’t know what to refresh.
  • Set the “Refresh” action and click on the “Submit” button.
  • Additionally, you may use “Flush Magento Cache” or “Flush Cache Storage” buttons.
    • Flush Magento Cache: Refresh the cache in the backend and inner cache with Magento tag.
    • Flush Cache Storage: Refresh cache of all Magento stores sharing one cache storage, though based on different servers.

clear cache from admin panel

 

Method 2: Magento 2 Clear Cache via Command Line

You can delete cache manually using the below commands from Command Line:

  • Enable the cache:

php bin/magento cache:enable

  • Disable the cache:

php bin/magento cache:disable

  • Flush the cache:

php bin/magento cache:flush

  • Clean the cache in the website:

php bin/magento cache:clean

To clean specific cache types, you need to specify the types, e.g.: config, layout, block_html, collections, reflection, db_ddl, eav, etc.

Method 3: Magento 2 Clear Cache Programmatically

Store admin may have the requirements to clean and flush cache programmatically in Magento 2. It is advisable to implement it in order to offer a speedy store to store users.

 

Full Page Cache

Enable Full Page Cache to enhance the performance of your website and increase the page load speed:

  • Navigate to Stores¬†>¬†Configuration¬†>¬†Advanced¬†>¬†System¬†>¬†Full Page Cache
  • Choose either Built-In Cache¬†or Varnish Cache

Note: Varnish cache is 4 to 9 times faster than Built-In Cache

enabling full page cache

You can implement the Full Page Cache Warmer for Magento 2. The module allows for speeding up your online store due to timely cache warming whenever needed. Also, you can exclude separate pages from warming and enable the auto-update cache after changes.

 

Know the difference between Magento 2 cache clean and cache flush:

Magento 2 Clean Cache: Deletes all enabled Cache type from Magento 2 due to which the disabled cache types are not cleaned.
Magento 2 Flush Cache: Cleans all the cache types collected in storage. It may affect other processing applications that run the same cache storage.

 

How to enable Cache Types?

For clearing specific cache types which have not been assigned Invalidated status, go to Cache Management and configure the following settings:

  • Select the cache types you want to enable.
  • Set Enable from the upper left drop-down menu.
  • Click “Submit” button.

enabling cache types

 

That’s all about Clearing Magento 2 Cache! I have tried to elaborate basic Magento 2 cache concepts, apply methods to cache your Magento 2 store and improve store performance.

Hopefully, the article is useful to you. Feel free to post your doubts and suggestions in the comments section. Both are much appreciated!

Flash 5 stars to appreciate my article if you really liked it.

Happy Caching ūüôā

Get Weekly Updates

Never miss Magento tips, tricks, tutorials, and news.

Thank you for subscribing.

Something went wrong.

4.7
(based on 14 Reviews)

Sanjay is a co-founder at Meetanshi. He is a Certified Magento Developer who loves creating Magento E-commerce solutions. Owing to his contributions in Magento Forums and posting solutions, he is among the top 50 contributors of the Magento community in 2019. When he is not engrossed with anything related to Magento, he loves to play cricket.

Leave a reply:

Your email address will not be published.