INTRODUCTION TO CACHE MANAGEMENT AND CLEANING CACHE IN MAGENTO

Today, we will look at the introduction to cache management. Caching significantly improves the performance of any website.  Typically, there are two ways to cache content. Browser side or client-side and server-side.  It is always considered better to store or cache the content requested by a client. So, that if they may request multiple times then the server won’t have to fulfill each request and thus makes efficient use of network bandwidth.

In the case of Magento, it allows full page caching out of the box. It so happens due to the presence of a PHP reverse proxy in its page cache library. By default, Magento’s default caching files are stored in any of the following:

  • File system
  • Databases
  • Redis

some pages are cacheable whereas some are not. Let us look at what are they?

Cache Management: Cacheable and Uncacheable Pages

In terms of cache management, cacheable and uncacheable pages signify whether a page should be cached or not. All the pages in Magento are by default cacheable. Even if a block in the entire layout becomes uncacheable then the entire page becomes uncacheable.

So how do we make a block uncacheable or create an uncacheable page? Well, to achieve that use the below command for that block.

 cacheable='false'. 

What is the Difference Between Public and Private Content?

Most of the content in a Magento website is private and dynamic that only caters to one particular user. however, PHP reverse proxies provide public content. Magento is capable of distinguishing between the two contents in order to tackle caching challenges.

  • Public Content:- Reverse proxies store public content on the server and hence it can be distributed amongst multiple customers. some of its examples are category listing, header, and footer.
  • Private Content:- This type of content is personal to a customer and so it is stored in the browser itself.  Its examples can be cart, wishlist, name, address, etc.

How to Clear Cache in Magento?

To successfully clear the cache in Magento run the commands below.

Step 1:  

 bin/magento cache:clean <type>.....<type> 

Step 2:  check cache status

 bin/magento cache:status 

We have covered the basics of cache management in Magento. To know more read HERE

Similar Posts