Magento 2 Clear Cache

How to Clear Cache in Magento 2?

Option 1: Magento 2 Clear Cache via Admin Panel

Option 2: Magento 2 Clear Cache via Command Line

Full Page Cache 

Magento 2 Cache Clean vs. Flush

How to enable cache types?

Cache is a separate area of your hosting server, which is used to store web pages through browsers to speed up the load processes. To solve the issue with updates made on your website content the cache should be refreshed. Thus each time you make changes to your online store you need to refresh the cache to make them visible on the frontend.

How to Clear Cache in Magento 2?

Everyone looks for a solution that allows for fast and effortless cache deleting in Magento 2. Here are the simplest methods to clear cache. 

Option 1: Magento 2 Clear Cache via Admin Panel

  • Navigate to the Admin Panel> System> Cache Management:

cache-management-magento

  • Define the cache types that need to be refreshed;
  • Tick the Cache Type blocks that are assigned Invalidated status or choose All if you don’t know what to refresh;
  • Set Refresh action and click the Submit button:

enabled-status-cache-magento

  • You can also use the ‘Flush Magento Cache’ and ‘Flush Cache Storage’ buttons directly.

*‘Flush Magento Cache’: allows for refreshing cache you see in the backend and inner cache with Magento tag;

*‘Flush Cache Storage’: allows for refreshing cache of all Magento stores sharing one cache storage (like Redis, Memcache), though based on different servers.

!If you run one of the cache storages together with Magento-based websites of other merchants, having refreshed it like that, you’ll clear their cache too!

Option 2: Magento 2 Clear Cache via Command Line

Magento 2 allows you to clear cache manually via the command line. To delete cache manually you may need the next commands: 

  • To enable the cache:

php bin/magento cache:enable

  • To disable the cache:

php bin/magento cache:disable

  • To flush the cache:

php bin/magento cache:flush

  • To clean the cache in the website:

php bin/magento cache:clean 

To clean particular cache types, you need to specify (comma-separated) the types, e.g.: config, layout, block_html, collections, reflection, db_ddl, eav, etc.

Full Page Cache

You can enable Full Page Cache option to enhance your website performance and speed up pages load:

  • Navigate to Store> Configuration> Advanced> System> Full Page Cache and choose one of the options you need Built-In Cache or Varnish Cache:

configurations-full-cache-magento

Built-in Cache setting is stated to be from 4 to 9 times faster than Varnish Cache.

Moreover, 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 when it’s required. Besides, you can exclude separate pages from warming and enable the auto-update cache after changes.

Magento 2 Cache Clean vs. Flush

To remove played out items from your website you can run both the commands: clean and flush Magento 2 cache. However, you need to learn the difference:

Clean cacheFlush cache
It deletes all enabled cache types from Magneto 2. Thus, disabled cache types are not cleaned. It cleans all the cache types collected in a storage, which may affect other processing applications that run the same cache storage, e.g.: other websites (even of other owners).

How to enable cache types?

If you need to clear particular cache types, which haven’t been automatically assigned Invalidated status, you need to return to the Cache Management menu to make the next settings:

  • Tick the cache types you need to refresh:

insert-cache-types-magento

  • Set Enable on the upper left drop-down menu and click Submit:

enable-cache-type-magento 

Rate the answer?