<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>cache - Tag Vibe</title>
	<atom:link href="https://www.tagvibe.com/tag/cache/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.tagvibe.com</link>
	<description>Connect. Create. Conquer.</description>
	<lastBuildDate>Mon, 06 May 2024 09:11:24 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.1</generator>

<image>
	<url>https://www.tagvibe.com/wp-content/uploads/2024/05/cropped-cropped-logo-tagvibe-1-32x32.png</url>
	<title>cache - Tag Vibe</title>
	<link>https://www.tagvibe.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to effectively use cache in Adobe Commerce(Magento)</title>
		<link>https://www.tagvibe.com/magento2-cache/</link>
		
		<dc:creator><![CDATA[Rajat kar]]></dc:creator>
		<pubDate>Tue, 14 Mar 2023 18:51:54 +0000</pubDate>
				<category><![CDATA[Magento2]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[magento2]]></category>
		<category><![CDATA[pagespeed]]></category>
		<guid isPermaLink="false">https://tagvibe.com/?p=274</guid>

					<description><![CDATA[<p>Caching is an important aspect of optimizing website performance in Magento. Here are some ways to effectively use cache in Adobe Commerce: Best Practices for caching Types Cache: Create a custom cache list in Magento In this code, replace &#60;Vendor&#62; with the name of your module vendor, and &#60;Module&#62; with the name of your module. Also, replace CustomCacheType with the name of your custom cache type. In this code, replace &#60;Vendor&#62; with the name of your module vendor, and &#60;Module&#62; with the name of your module. Also, replace CustomCacheType with the name of your custom cache type. Once your custom cache type is added, you can use it to cache custom data or functionality in your module. By effectively using cache in Adobe Commerce, you can significantly improve the performance of your website and provide a better user experience for your customers. Also read the what is partial caching in Mageto 2</p>
<p>The post <a href="https://www.tagvibe.com/magento2-cache/">How to effectively use cache in Adobe Commerce(Magento)</a> first appeared on <a href="https://www.tagvibe.com">Tag Vibe</a>.</p>]]></description>
										<content:encoded><![CDATA[<p class="gtfy-44">Caching is an important aspect of optimizing website performance in Magento. Here are some ways to effectively use cache in Adobe Commerce:</p>



<h2 class="wp-block-heading gtfy-47">Best Practices for caching</h2>



<ul class="wp-block-list gtfy-57">
<li class="gtfy-50 gutenify-list-item"><strong>Enable Full Page Cache (FPC</strong>): Adobe Commerce comes with a built-in Full Page Cache that can dramatically speed up the loading time of pages. Enabling FPC can be done by going to System &gt; Cache Management &gt; Full Page Cache and selecting &#8220;Enable&#8221; from the drop-down menu. Once enabled, FPC will store the HTML of each page, reducing the amount of processing required to generate each page.</li>



<li class="gtfy-51 gutenify-list-item"><strong>Use Varnish Cache: </strong>Varnish Cache is a powerful caching solution that can be used in conjunction with Adobe Commerce&#8217;s built-in FPC. Varnish Cache sits between the web server and the client and caches the content of each request, serving cached content to subsequent requests. To enable Varnish Cache, you need to configure it in your web server and configure Adobe Commerce to use it as a caching proxy.</li>



<li class="gtfy-52 gutenify-list-item"><strong>Use Redis Cache:</strong> Redis is an in-memory key-value store that can be used as a cache backend for Adobe Commerce. By default, Adobe Commerce uses file-based caching, which can be slow and inefficient. Redis can be faster and more efficient because it stores data in memory instead of on disk. To use Redis Cache in Adobe Commerce, you need to install and configure the Redis extension, and then configure Adobe Commerce to use Redis as a cache backend.</li>



<li class="gtfy-53 gutenify-list-item"><strong>Use Content Delivery Networks (CDN): </strong>A CDN is a network of servers that cache static content, such as images, CSS, and JavaScript files, and serves them from the server closest to the user. This can dramatically improve the loading time of static content and reduce the load on your server. Adobe Commerce has built-in support for CDN integration, which can be configured under System &gt; Configuration &gt; Web &gt; CDN.</li>



<li class="gtfy-56 gutenify-list-item"><strong>Monitor Cache Performance: </strong>It&#8217;s important to regularly monitor the performance of your caching solutions to ensure they are working effectively. You can use tools like New Relic or Blackfire to monitor the performance of your website and identify any caching-related issues.
<ul class="wp-block-list gtfy-55">
<li class="gtfy-54 gutenify-list-item"></li>
</ul>
</li>
</ul>



<h2 class="wp-block-heading gtfy-60">Types Cache:</h2>



<ul class="wp-block-list gtfy-73">
<li class="gtfy-63 gutenify-list-item"><strong>Configuration Cache</strong>: Stores configuration settings for the website, including the website&#8217;s system configuration and database configuration.</li>



<li class="gtfy-64 gutenify-list-item"><strong>Layout Cache</strong>: Stores the layout of pages and blocks on the website, including the position of blocks, their content, and other layout settings.</li>



<li class="gtfy-65 gutenify-list-item"><strong>Block Cache</strong>: Stores the HTML output of blocks on the website, reducing the amount of processing required to generate each page.</li>



<li class="gtfy-66 gutenify-list-item"><strong>Collections Data Cache</strong>: Stores data related to collections, such as product or category data, to speed up database queries.</li>



<li class="gtfy-67 gutenify-list-item"><strong>Reflection Cache</strong>: Stores metadata about classes and interfaces, reducing the amount of time required to load and process classes.</li>



<li class="gtfy-68 gutenify-list-item"><strong>Page Cache</strong>: Stores the entire HTML output of a page, including dynamic content, to reduce the amount of processing required to generate each page.</li>



<li class="gtfy-69 gutenify-list-item"><strong>EAV Cache:</strong> Stores data related to entities, attributes, and values, speeding up database queries.</li>



<li class="gtfy-70 gutenify-list-item">Translations Cache: Stores translations for the website, reducing the amount of processing required to generate translated content.</li>



<li class="gtfy-71 gutenify-list-item">I<strong>ntegration Configuration Cache</strong>: Stores configuration settings for integrations, including third-party integrations and APIs.</li>



<li class="gtfy-72 gutenify-list-item"><strong>Web API Cache</strong>: Stores data related to the Magento Web API, reducing the amount of processing required to generate API responses.</li>
</ul>



<h2 class="wp-block-heading gtfy-76">Create a custom cache list in Magento</h2>



<ul class="wp-block-list gtfy-81">
<li class="gtfy-79 gutenify-list-item">Create a new file named <code>cache.xml</code> in the directory <code>app/code/&lt;Vendor&gt;/&lt;Module&gt;/etc/</code>.</li>



<li class="gtfy-80 gutenify-list-item">In the cache.xml file, define the custom cache type by adding the following code:</li>
</ul>



<div class="wp-block-kevinbatdorf-code-block-pro gtfy-84" style="font-size:.875rem;line-height:1.25rem"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="<config xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation=&quot;urn:magento:framework:Cache/etc/cache.xsd&quot;&gt;
   <type name=&quot;custom_cache_type&quot; translate=&quot;label description&quot; instance=&quot;<Vendor&gt;\<Module&gt;\Cache\Type\CustomCacheType&quot;&gt;
       <label&gt;Custom Cache Type</label&gt;
       <description&gt;Custom Cache Type Description</description&gt;
   </type&gt;
</config&gt;" style="color:#d8dee9ff;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki nord" style="background-color: #2e3440ff"><code><span class="line"><span style="color: #81A1C1">&lt;config</span><span style="color: #D8DEE9FF"> </span><span style="color: #8FBCBB">xmlns</span><span style="color: #ECEFF4">:</span><span style="color: #8FBCBB">xsi</span><span style="color: #D8DEE9FF">=</span><span style="color: #ECEFF4">&quot;</span><span style="color: #A3BE8C">http://www.w3.org/2001/XMLSchema-instance</span><span style="color: #ECEFF4">&quot;</span><span style="color: #D8DEE9FF"> </span><span style="color: #8FBCBB">xsi</span><span style="color: #ECEFF4">:</span><span style="color: #8FBCBB">noNamespaceSchemaLocation</span><span style="color: #D8DEE9FF">=</span><span style="color: #ECEFF4">&quot;</span><span style="color: #A3BE8C">urn:magento:framework:Cache/etc/cache.xsd</span><span style="color: #ECEFF4">&quot;</span><span style="color: #81A1C1">&gt;</span></span>
<span class="line"><span style="color: #D8DEE9FF">   </span><span style="color: #81A1C1">&lt;type</span><span style="color: #D8DEE9FF"> </span><span style="color: #8FBCBB">name</span><span style="color: #D8DEE9FF">=</span><span style="color: #ECEFF4">&quot;</span><span style="color: #A3BE8C">custom_cache_type</span><span style="color: #ECEFF4">&quot;</span><span style="color: #D8DEE9FF"> </span><span style="color: #8FBCBB">translate</span><span style="color: #D8DEE9FF">=</span><span style="color: #ECEFF4">&quot;</span><span style="color: #A3BE8C">label description</span><span style="color: #ECEFF4">&quot;</span><span style="color: #D8DEE9FF"> </span><span style="color: #8FBCBB">instance</span><span style="color: #D8DEE9FF">=</span><span style="color: #ECEFF4">&quot;</span><span style="color: #A3BE8C">&lt;Vendor&gt;\&lt;Module&gt;\Cache\Type\CustomCacheType</span><span style="color: #ECEFF4">&quot;</span><span style="color: #81A1C1">&gt;</span></span>
<span class="line"><span style="color: #D8DEE9FF">       </span><span style="color: #81A1C1">&lt;label&gt;</span><span style="color: #D8DEE9FF">Custom Cache Type</span><span style="color: #81A1C1">&lt;/label&gt;</span></span>
<span class="line"><span style="color: #D8DEE9FF">       </span><span style="color: #81A1C1">&lt;description&gt;</span><span style="color: #D8DEE9FF">Custom Cache Type Description</span><span style="color: #81A1C1">&lt;/description&gt;</span></span>
<span class="line"><span style="color: #D8DEE9FF">   </span><span style="color: #81A1C1">&lt;/type&gt;</span></span>
<span class="line"><span style="color: #81A1C1">&lt;/config&gt;</span></span></code></pre></div>



<p class="gtfy-87">In this code, replace <code>&lt;Vendor&gt;</code> with the name of your module vendor, and <code>&lt;Module&gt;</code> with the name of your module. Also, replace <code>CustomCacheType</code> with the name of your custom cache type.</p>



<ul class="wp-block-list gtfy-92">
<li class="gtfy-90 gutenify-list-item">Create a new file named CustomCacheType.php in the directory app/code///Cache/Type/.</li>



<li class="gtfy-91 gutenify-list-item">In the <code>CustomCacheType.php</code> file, define the custom cache type class by adding the following code:</li>
</ul>



<div class="wp-block-kevinbatdorf-code-block-pro gtfy-95" style="font-size:.875rem;line-height:1.25rem"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="<?php
namespace <Vendor&gt;\<Module&gt;\Cache\Type;
class CustomCacheType extends \Magento\Framework\Cache\Frontend\Decorator\TagScope
{
   const TYPE_IDENTIFIER = 'custom_cache_type';
   const CACHE_TAG = 'CUSTOM_CACHE_TYPE';
   public function __construct(\Magento\Framework\App\Cache\Type\FrontendPool $cacheFrontendPool)
   {
       parent::__construct($cacheFrontendPool-&gt;get(self::TYPE_IDENTIFIER), self::CACHE_TAG);
   }
}
" style="color:#d8dee9ff;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki nord" style="background-color: #2e3440ff"><code><span class="line"><span style="color: #81A1C1">&lt;?</span><span style="color: #D8DEE9FF">php</span></span>
<span class="line"><span style="color: #81A1C1">namespace</span><span style="color: #D8DEE9FF"> </span><span style="color: #D8DEE9">&lt;Vendor&gt;\&lt;Module&gt;\Cache\Type;</span></span>
<span class="line"><span style="color: #D8DEE9FF">class CustomCacheType extends </span><span style="color: #ECEFF4">\</span><span style="color: #D8DEE9FF">Magento</span><span style="color: #ECEFF4">\</span><span style="color: #D8DEE9FF">Framework</span><span style="color: #ECEFF4">\</span><span style="color: #D8DEE9FF">Cache</span><span style="color: #ECEFF4">\</span><span style="color: #D8DEE9FF">Frontend</span><span style="color: #ECEFF4">\</span><span style="color: #D8DEE9FF">Decorator</span><span style="color: #ECEFF4">\</span><span style="color: #D8DEE9FF">TagScope</span></span>
<span class="line"><span style="color: #ECEFF4">{</span></span>
<span class="line"><span style="color: #D8DEE9FF">   </span><span style="color: #81A1C1">const</span><span style="color: #D8DEE9FF"> TYPE_IDENTIFIER </span><span style="color: #81A1C1">=</span><span style="color: #D8DEE9FF"> </span><span style="color: #ECEFF4">&#39;</span><span style="color: #A3BE8C">custom_cache_type</span><span style="color: #ECEFF4">&#39;</span><span style="color: #81A1C1">;</span></span>
<span class="line"><span style="color: #D8DEE9FF">   </span><span style="color: #81A1C1">const</span><span style="color: #D8DEE9FF"> CACHE_TAG </span><span style="color: #81A1C1">=</span><span style="color: #D8DEE9FF"> </span><span style="color: #ECEFF4">&#39;</span><span style="color: #A3BE8C">CUSTOM_CACHE_TYPE</span><span style="color: #ECEFF4">&#39;</span><span style="color: #81A1C1">;</span></span>
<span class="line"><span style="color: #D8DEE9FF">   </span><span style="color: #81A1C1">public</span><span style="color: #D8DEE9FF"> </span><span style="color: #81A1C1">function</span><span style="color: #D8DEE9FF"> </span><span style="color: #88C0D0">__construct</span><span style="color: #ECEFF4">(\</span><span style="color: #D8DEE9FF">Magento</span><span style="color: #ECEFF4">\</span><span style="color: #D8DEE9FF">Framework</span><span style="color: #ECEFF4">\</span><span style="color: #D8DEE9FF">App</span><span style="color: #ECEFF4">\</span><span style="color: #D8DEE9FF">Cache</span><span style="color: #ECEFF4">\</span><span style="color: #D8DEE9FF">Type</span><span style="color: #ECEFF4">\</span><span style="color: #8FBCBB">FrontendPool</span><span style="color: #D8DEE9FF"> </span><span style="color: #81A1C1">$</span><span style="color: #D8DEE9">cacheFrontendPool</span><span style="color: #ECEFF4">)</span></span>
<span class="line"><span style="color: #D8DEE9FF">   </span><span style="color: #ECEFF4">{</span></span>
<span class="line"><span style="color: #D8DEE9FF">       </span><span style="color: #81A1C1">parent::</span><span style="color: #88C0D0">__construct</span><span style="color: #ECEFF4">(</span><span style="color: #81A1C1">$</span><span style="color: #D8DEE9">cacheFrontendPool</span><span style="color: #81A1C1">-&gt;</span><span style="color: #88C0D0">get</span><span style="color: #ECEFF4">(</span><span style="color: #81A1C1">self::</span><span style="color: #D8DEE9FF">TYPE_IDENTIFIER</span><span style="color: #ECEFF4">),</span><span style="color: #D8DEE9FF"> </span><span style="color: #81A1C1">self::</span><span style="color: #D8DEE9FF">CACHE_TAG</span><span style="color: #ECEFF4">)</span><span style="color: #81A1C1">;</span></span>
<span class="line"><span style="color: #D8DEE9FF">   </span><span style="color: #ECEFF4">}</span></span>
<span class="line"><span style="color: #ECEFF4">}</span></span>
<span class="line"></span></code></pre></div>



<p class="gtfy-98">In this code, replace <code>&lt;Vendor&gt;</code> with the name of your module vendor, and <code>&lt;Module&gt;</code> with the name of your module. Also, replace <code>CustomCacheType</code> with the name of your custom cache type.</p>



<ul class="wp-block-list gtfy-102">
<li class="gtfy-101 gutenify-list-item">Clear the cache by running the following command in the Magento 2 root directory:</li>
</ul>



<div class="wp-block-kevinbatdorf-code-block-pro gtfy-105" style="font-size:.875rem;line-height:1.25rem"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="php bin/magento cache:clean
" style="color:#d8dee9ff;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki nord" style="background-color: #2e3440ff"><code><span class="line"><span style="color: #D8DEE9FF">php </span><span style="color: #A3BE8C">bin/magento</span><span style="color: #D8DEE9FF"> </span><span style="color: #A3BE8C">cache:clean</span></span>
<span class="line"></span></code></pre></div>



<ul class="wp-block-list gtfy-109">
<li class="gtfy-108 gutenify-list-item">Verify that your custom cache type is listed in the cache list by going to System &gt; Cache Management in the Magento 2 admin panel.</li>
</ul>



<p class="gtfy-112">Once your custom cache type is added, you can use it to cache custom data or functionality in your module.</p>



<p class="gtfy-115">By effectively using cache in Adobe Commerce, you can significantly improve the performance of your website and provide a better user experience for your customers.</p>



<p class="gtfy-118">Also read the <a href="https://tagvibe.com/partial-caching-in-magento-2/">what is partial caching in Mageto 2</a></p><p>The post <a href="https://www.tagvibe.com/magento2-cache/">How to effectively use cache in Adobe Commerce(Magento)</a> first appeared on <a href="https://www.tagvibe.com">Tag Vibe</a>.</p>]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
