Skip to content

Magento2 : Create Custom Cache to Reduce Server Load

Intro from wikipedia: web cache (or HTTP cache) is an information technology for the temporary storage (caching) of Web documents, such as web pagesimages, and other types of Web multimedia, to reduce server lag. A web cache system stores copies of documents passing through it; subsequent requests may be satisfied from the cache if certain conditions are met.[1] A web cache system can refer either to an appliance, or to a computer program.

so…, to achive this in Magento 2, here step to implement custom cache on your custom module

  1. create file YourCompany\YourModule\etc\cache.xml 

     
  2. Create Cache Model : YourCompany\YourModule\Model\Cache\YourCacheName.php

     
  3. Create a Helper to handle your cache : YourCompany\YourModule\Helper\Data.php

     
  4. Example usage your custom cache

     

 

Share

Comments are closed.