Magento2 | Cache Management for Beginner | Part2

Public Vs Private Content in Cache :

What is Public Content in cache : Header section, footer section, category listing pages, CMS pages are common pages that too serve for all (logged in or guest user). These data is basically called as Public content.These information are stored in

  • File System
  • Database
  • Redis or varnish or any custom 3rd party system cache

What is Private Content in cache : The details which are for specific customer level data called private content.These data will be stored from the client side (browser) instead of server. Following are the example pages

  • Customer Shopping cart / Checkout Page
  • Wishlist Products
  • Compare Products
  • Customer details

Where cache is stored in Magento2: Magento is having 3 different mechanism to store the cache.

  1. File system
  2. Database
  3. Redis.

Default Cache mechanism in magento2 : File System” is the by default mechanism is used to store the cached data. According to the requirement we can use other options. In this mechanism cached data will be store in following folder directory,

  • root>var/cache – Except page cache, all other magento2 cache object will be stored in this folder. Ex: Configuration, Layout, Block HTML, etc
  • root>var/page_cache – Page cache, full page cache content will be stored in this folder.

How to do the setup for File system cache in Magento2: We no need to do any configure via code level or admin . By default magento will store the cache into above specified folder.

More info refer : app/etc/di.xml

Suggested Cache mechanism by Magento : “Varnish” is one of recommended cache by Magento

Additional Information :

  1. root>var/generation – This folder contains auto generated Magento code like : Interceptors, DI configuration.
  2. root>var/view_preprocessed – This folder contains minified and complied files Ex: HTML, LESS,CSS
  3. root>pub/static – It contains JS and HTML files for each store view.

For More Info refer : https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/cache_for_frontdevs.html

Save Water !!! Save Earth !!!

Leave a Reply