Magento 2 Cache

The modern eCommerce technologies let merchants add any amount of items for sale.

However, a big number of products may potentially lead to a slower website performance, which will negatively influence customers’ shopping experience and conversion rate.

Luckily, Magento 2 lets you solve this issue by means of Full Page Cache. This functionality is available in the 2nd version of the platform in both Community and Enterprise editions.

From this article you will learn about:

  • types of Magento 2 cache,
  • enable and disable Magento 2 cache options,
  • advanced cache management,
  • Full Page Cache configuration,
  • the way to check cache status.

Let’s roll in!

How Does Magento 2 Full Page Cache Work?

First, let’s define what cache is.

Basically, сache is a system location, in which frequently accessed data gets stored.

By default, Magento uses multiple queries to get data from the database tables. It means that a bigger amount of time is spent on the results compiling process.

By using the cache functionality, it’s possible to prevent subsequent server side requests and lead content faster.

Magento 2 cache is in the var/cache directory off the store root with the settings located under System -> Cache Management.

Magento 2 has twelve default cache types. These are:

Magento 2 cache types

  • Configuration – generally, the system collects configuration info from all module/config.xml files and stocks it all together in the configuration cache; this setting lets you manage specific website and Store View cache type.
  • Layouts – this setting embraces the compiled page layout from all components; in case you implement some changes to your layout files, flush this cache type.
  • Blocks HTML output – comprises HTML page fragments per block; should be flushed after making updates to a store view layer.
  • Collections Data – contains the whole chain of database queries; gets cleaned automatically by the system.
  • Reflection Data – embraces any reflection data for API interfaces.
  • Database DDL operations – contains database schema.
  • Entity attribute value (EAV) — comprises metadata for EAV attributes (for instance, store labels, site search settings, links to certain pieces of PHP code, etc.).
  • Integrations Configuration and Integrations API Configuration – the former caches the compiled integrations while the latter — Compiled integration APIs.
  • Page Cache – HTML page code; should be flushed every time after making changes to the website HTML structure.
  • Translations – merged translations from any modules.
  • Web Services Configuration – basically, this is the cache Web API Structure of a website.

Enable Magento 2 Cache

To enable Magento 2 cache from here, either go to System -> Cache Management and enable the required cache types there.

Alternatively, you can do that from the Command line. This is what you need to enter:

Perform the following command as the file system owner for all cache types

 php bin/magento cache:enable 

to enable specific cache type

 php bin/magento cache:enable CACHE_TYPE

Disable Magento 2 Cache

To disable cache in Magento 2:

  • select all unnecessary cache types under System -> Cache Management
  • open the Actions drop-down menu on the left
  • select the ‘Disable’ option

To make sure the cache have been cleared, click the ‘Flush Magento Cache’ button in the right upper part of the working area.

Magento 2 cache management

Alternatively, you can disable caching in Magento 2 from the CLE (command line interface):

In order to disable all cache types, enter:

  php bin/magento cache:disable

Next enter:

  php bin/magento cache:flush

to make sure all the cache has been flushed.

Advanced Cache Management Options in Magento 2

From System -> Cache Management, you can:

Flush Magento Cache — this setting clears all entries in the default Magento cache (located in var/cache), all cache tags. This option calls the “flush()” function on “core/cache” model.

Flush Magento Storage — Clears all items in the cache (regardless of Magento tag), and might also affect 3d party applications if they're using it.

Clear Image Cache — clears all automatically watermarked and modified catalog images located in the media/catalog/product/cache folder.

Flush JavaScript/CSS Cache — clears the store cache from all the merged copies of JavaScript and CSS files.

Remove Cache —this option removes any preprocessed view and static files.

Full Page Cache Configuration

To configure the full-page cache, follow the steps below:

Select the ‘Stores’ option in the main navigation menu. From here, go to Configuration -> Advanced -> System and unfold the Full page cache option.

To change the default configuration settings, uncheck ‘Use System Value’ boxes.

 Magento 2 cache configuration

Now, under the ‘Caching Application’ settings, you can select either:

  • use a built-in application,
  • or set up Varnish Caching.

Below, you can define time-out for the page cache. The default value for this option is 86400, however, you can customize it according to your personal requirements.

If you select the ‘Varnish Cache’ option, the system will open you another set of settings to configure. These are the settings for an IP access list, backend host and port, plus some expand configuration options.

Magento 2 cache

  • Access list — here, you need to enter IP addresses or an IPs access list separated with ‘,’. This will purge Varnish configuration for the config file generation. If left empty, the system sets the default value as ‘localhost’.
  • Backend host — this is the place, where you need to enter the IP address of the backend host that is charge of the config files generation. The default value, like in the previous case, is ‘localhost’.
  • Backend port — next, in this field you can identify the backend port that is used for creating the config file.
  • And finally, in the Export Configuration field, you can specify the version of Varnish charge you are using use.

Cache Status

To check cache status, go to the command line and enter:

     php bin/magento cache:status

You will get somewhat like this:

Current status:

config: 1
layout: 1
block_html: 1
collections: 1
reflection: 1
db_ddl: 1
eav: 1
config_integration: 1
config_integration_api: 1
full_page: 1
translate: 1
config_webservice: 1

That’s basically it.


Emil Shamloo

posted on Feb 20, 2018
Hi, all of my caches are "disabled"
And I can not see "Enable" in the droppdown.
How can I make it appear?


posted on Mar 6, 2018
my magento version V1.9 , data not exist in DB its shifted in file format in CACHE. please help me.



posted on Mar 15, 2018
command line from magento install directory as the filesystem owner:

php bin/magento cache:enable


posted on Mar 15, 2018
Thank you, Dimitri


Submit Comment

* Required Fields