Cookies setting

Cookies help us enhance your experience on our site by storing information about your preferences and interactions. You can customize your cookie settings by choosing which cookies to allow. Please note that disabling certain cookies might impact the functionality and features of our services, such as personalized content and suggestions. Cookie Policy

Cookie Policy
Essential cookies

These cookies are strictly necessary for the site to work and may not be disabled.

Information
Always enabled
Advertising cookies

Advertising cookies deliver ads relevant to your interests, limit ad frequency, and measure ad effectiveness.

Information
Analytics cookies

Analytics cookies collect information and report website usage statistics without personally identifying individual visitors to Google.

Information
mageplaza.com

Magento 2 Cache and Page Cache Overview

Vinh Jacker | 12-18-2024

Magento 2 Cache and Page Cache Overview

Along with Magento\Cache library, Magento also uses Zend_Cache to interact with the cache Storage. In today’s post, let’s explore cache and page cache in Magento 2 together. I hope you find something useful in the below information.

Cache Overview

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,
    ),
); 

Page Cache Overview

In Magento, “page cache” means caching the entire page.
You can use the Default Cache which stores cache files on File system, Database or Redis.
Another option is to use Varnish which Magento recommended.

Cacheable and uncacheable pages

By default, all pages are cachable.
If you don’t want a page to be cached. You can add the cacheable="false" into the layout in any block.

Note:

  • If any block in a layout is designated as uncacheable, the entire page is uncacheable. Meaning if you add cacheable="false" into default.xml layout, your entire store will have no cache at all.
  • Only HTTP GET and HEAD requests are cacheable. For more information about caching, see RFC-2616 section 13.

Conclusion

That’s all! I hope this post has helped you understand cache and page cache in Magento 2. If you want to know more about these elements, refer to the following related posts.

Thanks for reading!

Related posts:

x
    Jacker

    With over a decade of experience crafting innovative tech solutions for ecommerce businesses built on Magento, Jacker is the mastermind behind our secure and well-functioned extensions. With his expertise in building user-friendly interfaces and robust back-end systems, Mageplaza was able to deliver exceptional Magento solutions and services for over 122K+ customers around the world.



    Related Post

    Website Support
    & Maintenance Services

    Make sure your store is not only in good shape but also thriving with a professional team yet at an affordable price.

    Get Started
    mageplaza services