How to Enable/Disable Cache in Magento 2
How to Disable/Enable Cache Command Line in Magento 2 is a general topic when you guys using Magento store. Magento 2 has 12 cache types by default. There are 5 simple commands to manage cache in command line. In this post I will show you to conduct each command line step by step. In previous post I talk about flush Magento Cache via command line.
First of all, we need to know what is cache?
What is Cache in Magento 2
When you first install your Magento store, the file system caching is enabled by default.
To change it, you can edit the env.php
in app/etc
folder. Find the cache_types
and change the value of the array_key value (1 or 0).
The settings should look like this:
'cache_types' =>
array (
'config' => 1,
'layout' => 1,
'block_html' => 1,
'collections' => 1,
'db_ddl' => 1,
'eav' => 1,
'full_page' => 0,
'translate' => 1,
'config_integration' => 1,
'config_webservice' => 1,
'config_integration_api' => 1,
),
);
Related topics:
- Configure Full Page Cache
- 10 Cache Types: How to Manage Cache
- Service Temporarily Unavailable
- Exception printing is disabled by default for security reasons
- 404 Error Page Not Found
- You Don’t Have Permission To Access / On This Server
How to Disable/Enable Cache in Backend
Step 1: Open Cache Management
Firstly, open your Magento backend. Then follow this System > Tools > Cache Management.
Step 2: Enable/ Disable cache type
In the Cache Management, you will see a table. Click on the box of the cache type that you want to enable or disable. Then, you will see a drop-down list on the left corner on the top of the screen. Choose the action you want and click the Submit button which is right next to it.
How to Disable/Enable Cache Command Line
Disable Cache command line
The following command will disable all cache types
php bin/magento cache:disable
If you would like to disable specific cache type, you should type command line
php bin/magento cache:disable CACHE_TYPE
Example:
php bin/magento cache:disable config
How to enable Cache command line
It is similar to how to Disable cache all types and specific cache type
Enable all cache types
php bin/magento cache:enable
Enable specific cache type
php bin/magento cache:enable CACHE_TYPE
Example
php bin/magento cache:enable layout
Enjoyed the tutorial? Spread it to your friends!
Featured Extensions







