This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

📣 Join our live AMA on the Future of Page Builders with Brizy's CEO! Register Now →

How to Enable & Disable Magento 2 Cache

Updated on December 24, 2021

6 Min Read
Magento 2 cache

Any online business owner is going to be concerned about performance. Luckily, the team at Magento regularly contributes the best solutions that benefit store owners within a fast-paced ecommerce ecosystem. 

In fact, I’d call Magento a never-ending product, with a variety of ever-increasing operations. In that vein, this blog is meant to give some insight into Magento 2 cache operations.

So without further ado, let’s take a look at the Magento 2 cache.

What is the Magento 2 Cache?

As you probably know, the cache is one of the easiest, quickest, and most effective ways to optimize website performance. Magento fulfills almost all the essential types of caches required for an ecommerce store. It allows the user to enable and disable caches through a single command line.

Install Magento 2 in a Single Click

Simplified Magento hosting that takes away your hosting woes

Magento 2 Cache Types

The table below describes the various cache types that Magento supports.

Cache Type Variable Description
Configuration config This cache contains store-specific settings in the file system and database. Magento collects configuration from all the modules, merges it, and saves the merged result to the cache for better store performance.
Layout layout It helps clean or flush this cache type after modifying layout files.
Block HTML output block_html This cache cleans or flushes HTML page fragments per block type after modifying the view layer.
Collections data collections/td> This helps cache results of database queries. It cleans or flushes if your custom module uses logic that results in cache entries Magento cannot clean.
DDL db_ddl This cache is related to the Database schema. It cleans or flushes when you make custom changes to the database schema. One way to automatically update the database schema is by using the Magento setup:db-schema:upgrade command.
Compiled Config compiled_config Compilation configuration
Entity attribute value (EAV) eav Metadata related to EAV attributes (for example, store labels, links to related PHP code, attribute rendering, search settings, and so on). You should not typically need to clean or flush this cache type.
Page cache full_page Magento cleans up this cache automatically, but third-party developers can put any data in any segment of the cache. It cleans or flushes after modifying code levels affecting HTML output. It is recommended to keep this cache enabled.
Reflection reflection Removes a dependency between the WebAPI module and the Customer module.
Translations translate After merging translations from all modules, the merger cache will be cleaned.
Integration configuration config_integration It cleans or flushes this cache after changing or adding integrations.
Integration API configuration config_integration_api Compiled integration APIs configuration of the store’s integrations.
Web services configuration config_webservice It helps in caching the Web API Structure.
Customer Notification customer_notification Temporary notifications that appear in the user interface.

How to Enable/Disable Magento 2 Cache from Backend

It is way simple to enable or disable Magento cache via the backend. All you need to do is log in to the Magento admin panel, and navigate to System > Cache, then Management under the Tools section.

Cache Management - Magento backend

On the first go, you will see a various number of cache types along with their description and status. Let’s say you want to enable/disable a cache type. Just check it and change the status. In the below image, I showed you how you can perform to Magento 2 disable cache.

Magento Disable Cache

Optimize Magento Speed Like a Pro

Subscribe now and get a free ebook to your inbox.

Thank You

Your Ebook is on it’s Way to Your Inbox.

Magento 2 Enable Cache Using Command line

Similarly, you can also enable the Magento 2 cache using the command line. Here, I will use Cloudways SSH command line interface to enable cache types. Use the following command line template:

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

Magento 2 Enable Cache for All Types

php bin/magento cache:enable

Magento 2 Enable Cache for Specific Type

php bin/magento cache:enable CACHE_TYPE

Example: Magento 2 Enable Cache

php bin/magento cache:enable layout

Magento 2 Disable Cache Using Command Line

Here’s the general command to disable Magento 2 cache:

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

The following command will disable all cache types

php bin/magento cache:disable

If you are looking to disable a specific cache type, this is the command that you need to use.

php bin/magento cache:disable CACHE_TYPE

Example on Magento 2 disable cache:

php bin/magento cache:disable config

How to Check Magento 2 Cache Status

To view the status on Magento 2 cache status, enter the following command line.

bin/magento cache:status

And you will see a result like:

Magento Cache Status

How to Clear Magento 2 Cache Using Command line

Use the following commands to flush and clear the Magento 2 cache:

php bin/magento cache:clean

The above command helps to flush the cache storage.

php bin/magento cache:flush

This command flushes the Magento 2 cache.

Recommended Cache Technologies for Magento Server

Magento recommends a couple of cache technologies to optimize store performance. When you look for a Magento store, ensure the hosting provider has these caches enabled with the Magento server.

Varnish Cache

Designed as an HTTP accelerator, Varnish enhances the performance of heavy content web applications like Magento. Therefore, the Varnish cache is part of the Cloudways hosting stack.

Magento Varnish

Memcached

Memcached is an open-source distributed memory caching system. It reduces that load by storing data objects in dynamic memory – short-term memory for web applications. Memcache configuration is also an integrated part of the Cloudways hosting stack.

Redis CacheRedis is an open-source (BSD licensed) used as a database, cache, and message broker. It provides data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperlogs, geospatial indexes, and streams. You can install/uninstall the Redis cache via the Cloudways dashboard.

Magento Redis
PHP OPCache
PHP OPCache is also recommended by Magento officially. It compiles and caches PHP scripts to bytecode instead of compiling on every request. That’s how it improves overall application performance.

PHP OPCache

In short, you need to take care of these Magento cache and server technologies to experience faster store performance.

Scalable, Super Fast, & Secure Magento Hosting

Our clients love us because we never compromise on security, performance and support.

Frequently Ask Questions

What is Magento 2 full-page cache?

Magento uses full-page caching on the server to quickly display category, product, and CMS pages. Full-page caching improves response time and reduces the loading on the server. Without caching, each page might need to run blocks of code and retrieve information from the database. With Cloudways, you can have Varnish as a full-page cache.

How many types of Magento Cache?

There are 12 types of Magento 2 Cache and all of them are effective in improving the speed, making your Store perform better.

How does Magento 2 cache work?

Magento collects configuration from all modules, merges it, and saves the merged result to the cache. This cache also contains store-specific settings stored in the file system and database. Clean or flush this cache type after modifying configuration files.

Where is Magento cache stored?

The Magento cached data is stored in files on a disk. You can find them on a server in the 

magento_installation_folder/var/cache/

and

magento_installation_folder/var/page_cache/

Final Words

I hope this article explains the importance of the Magento 2 cache, and how to enable/disable this. If you are also looking to get rid of server technicalities, try managed cloud hosting for your Magento store and get a FREE demo account for 3 days on DigitalOcean, Vultr or Linode.

Share your opinion in the comment section. COMMENT NOW

Share This Article

Abdur Rahman

Abdur Rahman is the Magento whizz at Cloudways. He is growth ambitious, and aims to learn & share information about Ecommerce & Magento Development through practice and experimentation. He loves to travel and explore new ideas whenever he finds time. Get in touch with him at [email protected]

×

Get Our Newsletter
Be the first to get the latest updates and tutorials.

Thankyou for Subscribing Us!

×

Webinar: How to Get 100% Scores on Core Web Vitals

Join Joe Williams & Aleksandar Savkovic on 29th of March, 2021.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Want to Experience the Cloudways Platform in Its Full Glory?

Take a FREE guided tour of Cloudways and see for yourself how easily you can manage your server & apps on the leading cloud-hosting platform.

Start my tour

CYBER WEEK SAVINGS

  • 0

    Days

  • 0

    Hours

  • 0

    Mints

  • 0

    Sec

GET OFFER

For 4 Months &
40 Free Migrations

For 4 Months &
40 Free Migrations

Upgrade Now