How to Enable, Disable, and Clear Cache in Magento 2?

Today, we’re going to teach you guys how to enable, disable, and clear cache in Magento 2.

Magento cache are basically pages or parts of pages that are stored to increase the page loading speed.

In simple words, a cache basically stores a page’s data for future calls to load it quicker than before.

These data include configuration, block HTML layout, collections, layout, integration configuration, reflection, Integration API configuration, DDL, EAV, and web service configuration.

Apart from this, you can also create and define other types of data to be cached for faster loading.

With that being said, let’s look at the steps to enable, disable, and clear cache in Magento 2.

Step-by-Step Process to Enable, Disable, and Clear Cache in Magento 2

First, we will see how to enable & disable cache in Magento 2. After that, we will see how to clear cache in Magento 2.

How to Enable & Disable Cache in Magento 2

There are two ways to enable & disable cache in Magento 2.

Using Backend

First of all, login to your admin panel and navigate to System > Tools > Cache Management.

magento cache management

After that, check the boxes on which cache type you would like to enable or disable.

And after checking the boxes, simply select the appropriate action button (Enable/Disable) from the top left corner.

Lastly, click on the Submit button to save changes.

Using Command Line

Command Line also allows Magento users to enable & disable all types of cache in Magento 2.

Now, to enable or disable the cache, you need to first know all types of cache available in your Magento 2 store.

To get the list of all cache types and their status, execute the following command:

magento cache:status

Now, in order to enable or disable cache in Magento 2, execute one of the following commands:

magento cache:enable [type] ... [type]

magento cache:disable [type] ... [type]

How to Clear Cache in Magento 2

Clearing a cache type basically deletes all data from the enabled cache type in Magento 2.

And just like enabling & disabling the cache, there are two ways to clear cache in Magento 2.

Using Backend

First of all, login to your admin panel and navigate to System > Tools > Cache Management.

After that, check the boxes on which cache type you would like to clear or flush.

Then, click on the Flush Magento Cache button in case you want to clean the cache.

And that’s it!

Using Command Line

You can also clear the cache in Magento 2 using the command line.

To clean a single cache type in Magento 2, execute one of the following commands:

magento cache:clean [type] ... [type]

magento cache:flush [type] ... [type]

And, to clear all cache types in Magento 2, execute the following command:

magento cache:flush

And it’s done!

Finally, check the status of the cache by executing the following command:

magento cache:status

Concluding Thoughts…

So, this is how you can enable, disable, and clear cache in Magento 2.

And if you need our professional assistance, feel free to contact us at any time.Magento Support Services