Clearing the cache in Magento 2 can help improve website performance and ensure that new changes or updates are reflected on the site. Here’s how to manually clear the cache in Magento 2:
- Connect to your server via SSH.
- Navigate to the Magento 2 root directory using the cd command.
- Run the following command to see a list of all available cache types:python
bin/magento cache:status
- To clear all caches, run the following command:python
bin/magento cache:clean
This command will clear all caches, including the configuration cache, layout cache, and block cache.
- To flush the cache storage, which includes all caches and cache metadata, run the following command:python
bin/magento cache:flush
This command will clear all caches and cache metadata, which can help ensure that new changes or updates are reflected on the site.
- If you want to clear specific cache types, run the following command:python
bin/magento cache:clean <cache_type>
Replace
<cache_type>
with the cache type you want to clear, such asconfig
,layout
,block_html
, orfull_page
. - If you want to enable or disable specific cache types, run the following command:bash
bin/magento cache:disable <cache_type>
Replace
<cache_type>
with the cache type you want to enable or disable.bashbin/magento cache:enable <cache_type>
Replace
<cache_type>
with the cache type you want to enable or disable.
That’s it! You have now manually cleared the cache in Magento 2.