<?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>Caching Archives - Sourced Code</title>
	<atom:link href="https://sourcedcode.com/blog/category/aem/caching/feed" rel="self" type="application/rss+xml" />
	<link>https://sourcedcode.com</link>
	<description>AEM Blog Made Just for You.</description>
	<lastBuildDate>Fri, 10 Apr 2026 20:15:24 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.8</generator>

<image>
	<url>https://sourcedcode.com/wp-content/uploads/2019/09/cropped-favicon-32x32.png</url>
	<title>Caching Archives - Sourced Code</title>
	<link>https://sourcedcode.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Pipeline-Free URL Redirects &#038; ACS Commons Redirect Map Manager Now Supported on AEMaaCS</title>
		<link>https://sourcedcode.com/blog/aem/pipeline-free-url-redirects-acs-commons-redirect-map-manager-now-supported-on-aemaacs</link>
					<comments>https://sourcedcode.com/blog/aem/pipeline-free-url-redirects-acs-commons-redirect-map-manager-now-supported-on-aemaacs#respond</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Thu, 07 Nov 2024 02:11:50 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[AEMaaCS]]></category>
		<category><![CDATA[Caching]]></category>
		<category><![CDATA[Dispatcher]]></category>
		<guid isPermaLink="false">https://sourcedcode.com/?p=7520</guid>

					<description><![CDATA[<p>Adobe’s recent AEM version 18311 release (October 28-30, 2024) brings valuable updates for URL redirection management in AEM as a Cloud Service (AEMaaCS). This release introduces Pipeline-Free URL Redirects and, importantly, full support for ACS Commons Redirect Map Manager. These changes allow AEM developers to manage URL redirects directly within the AEM Cloud environment, with [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/pipeline-free-url-redirects-acs-commons-redirect-map-manager-now-supported-on-aemaacs">Pipeline-Free URL Redirects &#038; ACS Commons Redirect Map Manager Now Supported on AEMaaCS</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Adobe’s recent <strong>AEM version <a href="https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/release-notes/maintenance/2024/2024-10-0?lang=en#18311" rel="noopener" target="_blank">18311</a></strong> release (October 28-30, 2024) brings valuable updates for URL redirection management in <strong>AEM as a Cloud Service (AEMaaCS)</strong>. This release introduces <strong><a href="https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/content-delivery/pipeline-free-url-redirects" rel="noopener" target="_blank">Pipeline-Free URL Redirects</a></strong> and, importantly, full support for <strong><a href="https://adobe-consulting-services.github.io/acs-aem-commons/features/redirect-map-manager/index.html" rel="noopener" target="_blank">ACS Commons Redirect Map Manager</a></strong>. These changes allow AEM developers to manage URL redirects directly within the AEM Cloud environment, with improved performance, scalability, and flexibility.</p>
<div class="mention-block">
    <strong>Quick Links</strong></p>
<ol>
<li><a href="#background_redirect_map_manager_vs_redirect_manager_in_aemaacs">Background: Redirect Map Manager vs. Redirect Manager in AEMaaCS</a></li>
<li><a href="#key_benefits_of_the_new_setup">Key Benefits of the New Setup</a></li>
<li><a href="#how_to_configure_pipeline_free_url_redirects_with_redirect_map_manager">How to Configure Pipeline-Free URL Redirects with Redirect Map Manager</a></li>
<li><a href="#conclusion">Conclusion</a></li>
</ol>
</div>
<p><a href="https://sourcedcode.com/wp-content/uploads/2024/11/adobes-redirect-solutions.png"><img fetchpriority="high" decoding="async" src="https://sourcedcode.com/wp-content/uploads/2024/11/adobes-redirect-solutions.png" alt="Adobe's Supported AEMaaCS Redirect Solutions" width="1642" height="872" class="alignnone size-full wp-image-7524" srcset="https://sourcedcode.com/wp-content/uploads/2024/11/adobes-redirect-solutions.png 1642w, https://sourcedcode.com/wp-content/uploads/2024/11/adobes-redirect-solutions-300x159.png 300w, https://sourcedcode.com/wp-content/uploads/2024/11/adobes-redirect-solutions-1024x544.png 1024w, https://sourcedcode.com/wp-content/uploads/2024/11/adobes-redirect-solutions-768x408.png 768w, https://sourcedcode.com/wp-content/uploads/2024/11/adobes-redirect-solutions-1536x816.png 1536w, https://sourcedcode.com/wp-content/uploads/2024/11/adobes-redirect-solutions-600x319.png 600w" sizes="(max-width: 1642px) 100vw, 1642px" /></a></p>
<hr class="spacer-large"/>
<h2 id="background_redirect_map_manager_vs_redirect_manager_in_aemaacs">Background: Redirect Map Manager vs. Redirect Manager in AEMaaCS</h2>
<p>Previously, <strong>ACS Commons Redirect Map Manager</strong> was unsupported on AEMaaCS, limiting options for handling redirects. As a workaround, customers needed to use <strong>ACS Commons Redirect Manager</strong>, which came with several challenges:</p>
<ul>
<li><strong>Reliance on Dispatcher Rules</strong>: Redirect Manager required that all redirect requests pass through the Dispatcher’s rules to reach the AEM publishers, where Redirect Manager rules could then be executed. This dependency on Dispatcher configurations often led to complications. Only requests meeting specific Dispatcher criteria reached the publisher, and requests blocked by earlier Dispatcher rules (e.g., rules for file types or specific paths) would bypass the publisher entirely, causing some redirects to fail.</li>
<li><strong>Potential for Conflicting Rules</strong>: Dispatcher has its own rewrite rules, which can sometimes interfere with redirects set in Redirect Manager. If a Dispatcher rewrite rule processes a request before it reaches Redirect Manager, it can override the redirect, leading to unexpected behaviors or even redirect loops. This makes troubleshooting and coordinating rules more challenging.</li>
<li><strong>Increased Maintenance and Complexity</strong>: Coordinating Dispatcher rules with Redirect Manager required ongoing adjustments to ensure consistency across both levels. This setup added maintenance overhead, as new rules or configurations in the Dispatcher required verification to avoid interfering with existing redirects.</li>
</ul>
<p>With <strong>AEM version <a href="https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/release-notes/maintenance/2024/2024-10-0?lang=en#18311" rel="noopener" target="_blank">18311</a></strong> and the support for <strong>ACS Commons Redirect Map Manager</strong>, these limitations are greatly reduced. Redirect Map Manager now allows redirect processing to be handled entirely at the edge by the Dispatcher, minimizing reliance on AEM publishers and aligning with Adobe’s best practices for cloud environments.</p>
<hr class="spacer-large"/>
<h2 id="key_benefits_of_the_new_setup">Key Benefits of the New Setup</h2>
<h3>1. Offloading Redirects to the Dispatcher</h3>
<p>With <strong>ACS Commons Redirect Map Manager</strong>, redirect processing is managed at the Dispatcher level, reducing the need for requests to be handled by publishers. This shift improves performance and scalability:</p>
<ul>
<li><strong>Previous Configuration with Redirect Manager</strong>: The first request for a redirect had to be processed by the AEM publisher, placing load on the AEM instance until CDN caching took effect. For high-traffic sites, this dependency on the publisher created potential performance bottlenecks.</li>
<li><strong>New Configuration with Redirect Map Manager</strong>: Redirects are processed directly by the Dispatcher, with CDN caching supporting subsequent requests. This reduces publisher load and improves response times, allowing for smoother handling of large-scale redirects.</li>
</ul>
<h3>2. Simplified Management with Fewer Conflicts</h3>
<p>Redirect Map Manager reduces the likelihood of conflicts with Apache’s Dispatcher rewrite rules:</p>
<ul>
<li><strong>Better Coordination with Dispatcher Rules</strong>: With redirect processing fully managed at the Dispatcher, Redirect Map Manager rules are less likely to conflict with existing rewrite rules, eliminating the need to pass through complex Dispatcher configurations to reach the publisher.</li>
<li><strong>Reduced Complexity</strong>: Redirect Map Manager’s edge-based handling simplifies redirect rule management, enabling more consistent behavior and reducing the need for Dispatcher-publisher coordination.</li>
</ul>
<h3>3. Greater Flexibility for Business Users</h3>
<p>This update provides a more accessible and flexible redirection setup for business users who need to control redirects but may lack access to development pipelines:</p>
<ul>
<li><strong>User-Friendly Management Interface</strong>: ACS Commons Redirect Map Manager offers an intuitive interface within AEM for managing redirects. Business users can easily create, edit, and organize large numbers of redirects without requiring deployments or extensive pipeline configurations.</li>
<li><strong>Scalability for Large-Scale Operations</strong>: Redirect Map Manager supports thousands of redirects directly within AEM, making it ideal for business-driven redirect management at scale.</li>
</ul>
<hr class="spacer-large"/>
<h2 id="how_to_configure_pipeline_free_url_redirects_with_redirect_map_manager">How to Configure Pipeline-Free URL Redirects with Redirect Map Manager</h2>
<p>Setting up pipeline-free redirects with the ACS Commons Redirect Map Manager in AEMaaCS is straightforward:</p>
<ol>
<li><strong>Define Redirect Maps</strong>: In the <span class="code-highlight-secondary">managed-rewrite-maps.yaml</span> file, specify paths to redirect files stored in the publish repository.</li>
<li><strong>Manage Redirects in Redirect Map Manager</strong>: Use the Redirect Map Manager’s user interface to set up and organize redirect mappings. The tool’s UI allows direct integration with Dispatcher for a streamlined process.</li>
<li><strong>Configure Apache RewriteMap</strong>:
<ul>
<li>Set up the <span class="code-highlight-secondary">RewriteMap</span> directive in Apache to ensure optimal redirect caching and performance at the Dispatcher level. Here’s a sample configuration:</li>
</ul>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">RewriteMap map.<span style="color: #006633;">foo</span> dbm<span style="color: #339933;">=</span>sdbm<span style="color: #339933;">:/</span>tmp<span style="color: #339933;">/</span>rewrites<span style="color: #339933;">/</span>my.<span style="color: #006633;">map</span><br />
RewriteCond $<span style="color: #009900;">&#123;</span>map.<span style="color: #006633;">foo</span><span style="color: #339933;">:</span>$1<span style="color: #009900;">&#125;</span> <span style="color: #339933;">!</span><span style="color: #0000ff;">&quot;&quot;</span><br />
RewriteRule <span style="color: #339933;">^</span><span style="color: #009900;">&#40;</span>.<span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>$ $<span style="color: #009900;">&#123;</span>map.<span style="color: #006633;">foo</span><span style="color: #339933;">:</span>$1<span style="color: #339933;">|/</span><span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#91;</span>L,R<span style="color: #339933;">=</span><span style="color: #cc66cc;">301</span><span style="color: #009900;">&#93;</span></div></td></tr></tbody></table></div>
</li>
</ol>
<p>For a deeper dive into this feature, visit Adobe’s full article: <a href="https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/content-delivery/pipeline-free-url-redirects" target="_blank" rel="noopener">Pipeline-Free URL Redirects</a>.</p>
<p>Visit the official <a href="https://adobe-consulting-services.github.io/acs-aem-commons/features/redirect-map-manager/index.html" rel="noopener" target="_blank">ACS Commons Redirect Map Manager Page</a>.</p>
<hr class="spacer-large"/>
<h2 id="conclusion">Conclusion</h2>
<p>The introduction of ACS Commons Redirect Map Manager support in AEMaaCS marks a significant improvement in URL redirection management. By handling redirects at the Dispatcher, this feature enhances performance, reduces complexity, and minimizes publisher load, all while aligning with Adobe’s best practices for AEM Cloud environments.</p>
<p>With these changes, managing large-scale redirects in AEMaaCS becomes more efficient, flexible, and scalable, making it easier for teams to maintain high performance and consistency across their AEM implementations.</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/pipeline-free-url-redirects-acs-commons-redirect-map-manager-now-supported-on-aemaacs">Pipeline-Free URL Redirects &#038; ACS Commons Redirect Map Manager Now Supported on AEMaaCS</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/pipeline-free-url-redirects-acs-commons-redirect-map-manager-now-supported-on-aemaacs/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Clear &#038; Flush AEMaaCS Cache After Code Deployment</title>
		<link>https://sourcedcode.com/blog/aem/how-to-clear-flush-aemaacs-cache-after-code-deployment</link>
					<comments>https://sourcedcode.com/blog/aem/how-to-clear-flush-aemaacs-cache-after-code-deployment#respond</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Tue, 13 Aug 2024 04:19:51 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[AEMaaCS]]></category>
		<category><![CDATA[Caching]]></category>
		<guid isPermaLink="false">https://sourcedcode.com/?p=7316</guid>

					<description><![CDATA[<p>Flushing the cache in Adobe Experience Manager as a Cloud Service (AEMaaCS) after a code deployment is a critical step to ensure that users receive the most up-to-date content. Good new for you, AEMaaCS automates much of this process through its rolling deployment strategy, which involves coordinated steps to deploy code, update configurations, and invalidate [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/how-to-clear-flush-aemaacs-cache-after-code-deployment">How to Clear &#038; Flush AEMaaCS Cache After Code Deployment</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Flushing the cache in Adobe Experience Manager as a Cloud Service (AEMaaCS) after a code deployment is a critical step to ensure that users receive the most up-to-date content. Good new for you, AEMaaCS automates much of this process through its rolling deployment strategy, which involves coordinated steps to deploy code, update configurations, and invalidate the Dispatcher cache across all instances.</p>
<div class="mention-block">
    <strong>Quick Links</strong></p>
<ol>
<li><a href="#rolling_deployment_process_in_aemaa_cs">Rolling Deployment Process in AEMaaCS</a></li>
<li><a href="#why_is_this_process_important">Why Is This Process Important?</a></li>
<li><a href="#additional_considerations">Additional Considerations</a></li>
</ol>
</div>
<hr class="spacer-large"/>
<h2 id="rolling_deployment_process_in_aemaa_cs">1. Rolling Deployment Process in AEMaaCS</h2>
<p>During a production deployment, AEMaaCS follows a rolling deployment strategy to minimize downtime and ensure continuous availability. Here’s how it works:</p>
<ol>
<li><strong>Deploy AEM Packages to Author:</strong>
<ul>
<li>The deployment begins by pushing the updated AEM packages to the author instance. This ensures that the author environment is updated first, preparing it for any content authoring that might be needed post-deployment.</li>
</ul>
</li>
<li><strong>Detach Dispatcher1 from the Load Balancer:</strong>
<ul>
<li>The first Dispatcher (dispatcher1) is temporarily removed from the load balancer. This prevents it from serving any requests during the deployment, ensuring that users do not access potentially outdated or unstable content.</li>
</ul>
</li>
<li><strong>Deploy AEM Packages to Publish1 and Dispatcher1:</strong>
<ul>
<li>With dispatcher1 detached, the deployment of AEM packages to the first publish instance (publish1) and the corresponding Dispatcher package to dispatcher1 occurs simultaneously.</li>
<li>After the deployment, the <span class="code-highlight-primary">Dispatcher cache is flushed</span>. This step is critical as it clears the old cache, ensuring that the updated content is served once the Dispatcher is brought back online.</li>
</ul>
</li>
<li><strong>Reattach Dispatcher1 to the Load Balancer:</strong>
<ul>
<li>Once the deployment to publish1 and the cache flush on dispatcher1 are complete, dispatcher1 is added back to the load balancer. It can now serve requests with the updated content and configurations.</li>
</ul>
</li>
<li><strong>Repeat for Dispatcher2:</strong>
<ul>
<li>The process is repeated for the second Dispatcher (dispatcher2). Dispatcher2 is detached from the load balancer, the deployment is made to publish2 and dispatcher2, the <span class="code-highlight-primary">cache is flushed</span>, and then dispatcher2 is reattached to the load balancer.</li>
</ul>
</li>
<li><strong>Continue for All Instances:</strong>
<ul>
<li>This rolling deployment process continues until all publish and Dispatcher instances in the topology have been updated. By updating one Dispatcher at a time, AEMaaCS ensures that there is always at least one Dispatcher available to serve requests, thus maintaining high availability throughout the deployment.</li>
</ul>
</li>
</ol>
<hr class="spacer-large"/>
<h2 id="why_is_this_process_important">2. Why Is This Process Important?</h2>
<p>Flushing the Dispatcher cache after code deployment is essential for ensuring that users receive the latest content and that no outdated files are served. The rolling deployment strategy employed by AEMaaCS automates this process, making it seamless and reducing the risk of downtime or content inconsistencies.</p>
<hr class="spacer-large"/>
<h2 id="additional_considerations">3. Additional Considerations</h2>
<p>While AEMaaCS automates much of the deployment and cache flushing process, it’s important to ensure that your Dispatcher configurations are optimized for this process. Properly configured <span class="code-highlight-primary">.stat</span> files and cache invalidation rules help to ensure that the cache is only flushed when necessary, preserving performance while ensuring content freshness.</p>
<p>For more detailed information on the rolling deployment process and how AEMaaCS handles cache invalidation, refer to the official <a href="https://experienceleague.adobe.com/en/docs/experience-manager-cloud-manager/content/using/code-deployment" target="_blank" rel="noopener">Adobe Experience Manager documentation</a> .</p>
<p>This step-by-step approach ensures a smooth transition during code deployments, keeping your AEM environment optimized and responsive.</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/how-to-clear-flush-aemaacs-cache-after-code-deployment">How to Clear &#038; Flush AEMaaCS Cache After Code Deployment</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/how-to-clear-flush-aemaacs-cache-after-code-deployment/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Serving New Client Library CSS and JS After Release on AEM as a Cloud Service (AEMaaCS)</title>
		<link>https://sourcedcode.com/blog/aem/serving-new-client-library-css-and-js-after-release-on-aem-as-a-cloud-service-aemaacs</link>
					<comments>https://sourcedcode.com/blog/aem/serving-new-client-library-css-and-js-after-release-on-aem-as-a-cloud-service-aemaacs#respond</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Wed, 31 Jul 2024 06:25:19 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[AEMaaCS]]></category>
		<category><![CDATA[Caching]]></category>
		<guid isPermaLink="false">https://sourcedcode.com/?p=7232</guid>

					<description><![CDATA[<p>How does new client library code for JS and CSS gets served in my AEMaaCS website after development, staging, production release, and how does the correct version of the client libs are being used on AEMaaCS? Ensuring that users receive the latest updates—such as new client libraries (CSS and JS)—requires a carefully managed caching strategy. [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/serving-new-client-library-css-and-js-after-release-on-aem-as-a-cloud-service-aemaacs">Serving New Client Library CSS and JS After Release on AEM as a Cloud Service (AEMaaCS)</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>How does new client library code for JS and CSS gets served in my AEMaaCS website after development, staging, production release, and how does the correct version of the client libs are being used on AEMaaCS?</p>
<p>Ensuring that users receive the latest updates—such as new client libraries (CSS and JS)—requires a carefully managed caching strategy. This article explores how cache invalidation is handled upon releasing new code, particularly clientlibs, and uses the Adobe WKND project as an example to explain the process.</p>
<div class="mention-block">
    <strong>Quick Links</strong></p>
<ol>
<li><a href="#introduction">Introduction</a></li>
<li><a href="#automatic_cache_invalidation_how_it_works">Automatic Cache Invalidation: How It Works</a></li>
<li><a href="#example_configuration_adobe_wknd_project">Example Configuration: Adobe WKND Project</a></li>
<li><a href="#breakdown_of_the_configuration">Breakdown of the Configuration</a></li>
<li><a href="#key_mechanisms_and_timings">Key Mechanisms and Timings</a></li>
<li><a href="#conclusion">Conclusion</a></li>
</ol>
</div>
<hr class="spacer-large"/>
<h2 id="introduction">1. Introduction</h2>
<p>In this article, we will step through how typically an AEMaaCS website serves newly released client-libraries JS and CSS to users, and we will take a look at the <a href="https://github.com/adobe/aem-guides-wknd/blob/33aa8fda2defe45a6c8c8607ead0026e1492ff01/dispatcher/src/conf.d/available_vhosts/wknd.vhost#L158" rel="noopener" target="_blank">Adobe WKND project</a> as an example.</p>
<hr class="spacer-large"/>
<h2 id="automatic_cache_invalidation_how_it_works">2. Automatic Cache Invalidation: How It Works</h2>
<p>Upon releasing new client libraries, AEMaaCS uses versioned clientlibs. This involves adding a unique hash (previous understanding of the hash generated is pretty much converting the entire minified CSS and JS into <a href="https://adobe-consulting-services.github.io/acs-aem-commons/features/versioned-clientlibs/index.html" rel="noopener" target="_blank">MD5 Hash &#8211; ACS Commons Approach</a>) to the filenames of clientlibs, served on newly fresh requested HTML pages from the AEM publishers, which forces the CDN and browser caches to recognize and fetch the new files. This automatic mechanism helps ensure that users are served the updated versions. </p>
<p>And please keep in mind, it&#8217;s the fresh uncached version of the AEM .html pages who actually serves the path of the versioned clientlibs files. Lets understand .html are cached invalidated from the dispatcher and CDN cache.</p>
<p>Examples of hashed client libs:<br />
/etc.clientlibs/settings/wcm/designs/gandalf/clientlibs/css/all.en-us.min.LIHASHed376af2042959edf283b2591e37eff9.css
</p>
<hr class="spacer-large"/>
<h2 id="example_configuration_adobe_wknd_project">3. Example Configuration: Adobe WKND Project</h2>
<p>In this article, we will purely inspect the <a href="https://github.com/adobe/aem-guides-wknd/blob/33aa8fda2defe45a6c8c8607ead0026e1492ff01/dispatcher/src/conf.d/available_vhosts/wknd.vhost#L158" rel="noopener" target="_blank">Adobe WKND project</a> which is production live code examples of recommended rules for cache invalidating .html files. The following configuration from the WKND project shows how HTML pages are handled in terms of caching:</p>
<div class="codecolorer-container apache default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="apache codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">&lt;<span style="color: #000000; font-weight:bold;">LocationMatch</span> <span style="color: #7f007f;">&quot;^/content/.*<span style="color: #000099; font-weight: bold;">\.</span>html$&quot;</span>&gt;<br />
&nbsp; &nbsp; <span style="color: #00007f;">Header</span> unset Cache-Control<br />
&nbsp; &nbsp; <span style="color: #00007f;">Header</span> always set Cache-Control <span style="color: #7f007f;">&quot;max-age=300,stale-while-revalidate=3600&quot;</span> <span style="color: #7f007f;">&quot;expr=%{REQUEST_STATUS} &lt; 400&quot;</span><br />
&nbsp; &nbsp; <span style="color: #00007f;">Header</span> always set Surrogate-Control <span style="color: #7f007f;">&quot;stale-while-revalidate=43200,stale-if-error=43200&quot;</span> <span style="color: #7f007f;">&quot;expr=%{REQUEST_STATUS} &lt; 400&quot;</span><br />
&nbsp; &nbsp; <span style="color: #00007f;">Header</span> set Age <span style="color: #ff0000;">0</span><br />
&lt;/<span style="color: #000000; font-weight:bold;">LocationMatch</span>&gt;</div></td></tr></tbody></table></div>
<hr class="spacer-large"/>
<h2 id="breakdown_of_the_configuration">4. Breakdown of the Configuration</h2>
<p>1. <strong> LocationMatch, Targeting HTML Pages:</strong></p>
<p>&#8211; The configuration applies to all HTML pages under the <span class="code-highlight-primary">/content/</span> path.</p>
<p>2. <strong>Cache-Control Settings:</strong></p>
<ul>
<li><span class="code-highlight-primary">max-age=300</span>: HTML pages are cached for 5 minutes. During this time, the CDN serves the cached content without checking with the origin server.</li>
<li><span class="code-highlight-primary">stale-while-revalidate=3600</span>: After 5 minutes, if a request is made, the CDN serves the stale content and fetches a new version from the server in the background. This background fetch happens within 1 hour, ensuring minimal disruption.</li>
</ul>
<p>3. <strong>Surrogate-Control for CDN:</strong></p>
<ul>
<li><span class="code-highlight-primary">stale-while-revalidate=43200</span>: The CDN can continue serving stale content while fetching fresh content for up to 12 hours.</li>
<li><span class="code-highlight-primary">stale-if-error=43200</span>: In the event of errors fetching the new content, the CDN serves stale content for up to 12 hours.</li>
</ul>
<p>4. <strong>Age Header:</strong></p>
<p>&#8211; <span class="code-highlight-primary">Header set Age 0</span>: This resets the age of the content to zero, indicating that it is freshly cached.</p>
<hr class="spacer-large"/>
<h2 id="key_mechanisms_and_timings">5. Key Mechanisms and Timings</h2>
<p><strong>Initial Cache Period (<span class="code-highlight-primary">max-age=300</span>):</strong></p>
<p>&#8211; For the first 300 seconds (5 minutes) after the content is cached, the CDN serves the cached version without rechecking with the origin server.</p>
<p><strong>Stale-While-Revalidate (<span class="code-highlight-primary">stale-while-revalidate=3600</span>):</strong></p>
<p>&#8211; After 5 minutes, the <span class="code-highlight-primary">max-age</span> period expires, if a user requests the content, the CDN serves the stale (cached) content immediately and fetches a new version from the origin server in the background. This mechanism ensures that users receive immediate responses, even if the content is slightly outdated, while the cache is refreshed in the background. And again, <em style="color:red;">it&#8217;s the fresh uncached version of the AEM .html pages who actually serves the path of the versioned clientlibs files, which is why invalidation on the HTML file is important here.</em></p>
<p><strong>After Stale-While-Revalidate:</strong></p>
<p>&#8211; If a new version has not been successfully fetched within the <span class="code-highlight-primary">stale-while-revalidate</span> window (up to 1 hour), and another request is made, the CDN serves the most recently cached version while attempting to fetch the new version again.</p>
<hr class="spacer-large"/>
<h2 id="conclusion">6. Conclusion</h2>
<p>The correct dispatcher configurations ensures that new client libraries and other updates are served efficiently. The HTML pages need to reference the new clientlibs versioned paths to reflect the latest updates. Since the WKND configuration sets HTML page caching to a maximum of 5 minutes with additional revalidation periods, the new HTML pages and associated clientlibs may not appear immediately; after 5 minutes, if a user requests the content, the CDN serves the stale (cached) content immediately and fetches a new version from the origin server in the background. This mechanism ensures that users receive immediate responses, even if the content is slightly outdated, while the cache is refreshed in the background, the <span class="code-highlight-primary">stale-while-revalidate</span> directive helps ensure users see updated content with minimal disruption. This setup minimizes the impact of cache misses and ensures that updated content is available without noticeable delay to the user. This well-balanced approach allows for efficient content delivery while maintaining a seamless user experience.</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/serving-new-client-library-css-and-js-after-release-on-aem-as-a-cloud-service-aemaacs">Serving New Client Library CSS and JS After Release on AEM as a Cloud Service (AEMaaCS)</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/serving-new-client-library-css-and-js-after-release-on-aem-as-a-cloud-service-aemaacs/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Caching Experience Fragment Techniques in AEM Sites 6.5</title>
		<link>https://sourcedcode.com/blog/aem/caching-experience-fragments-with-aem-sites-6-5</link>
					<comments>https://sourcedcode.com/blog/aem/caching-experience-fragments-with-aem-sites-6-5#comments</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Fri, 20 Sep 2019 14:29:01 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[Caching]]></category>
		<guid isPermaLink="false">https://sourcedcode.com/?p=448</guid>

					<description><![CDATA[<p>This article explains different techniques to handle cache invalidation with AEM experience fragments. This topic will cover some of the questions that have been asked: What are the most efficient ways to cache AEM Experience Fragments in AEM? What are different ways to cache AEM Experience Fragments in AEM? What are the caching strategies for [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/caching-experience-fragments-with-aem-sites-6-5">Caching Experience Fragment Techniques in AEM Sites 6.5</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>This article explains different techniques to handle cache invalidation with AEM experience fragments.</p>
<p>This topic will cover some of the questions that have been asked:</p>
<ul>
<li>What are the most efficient ways to cache AEM Experience Fragments in AEM?</li>
<li>What are different ways to cache AEM Experience Fragments in AEM?</li>
<li>What are the caching strategies for AEM Experience Fragments in AEM?</li>
</ul>
<div class="mention-block">
<p>Quick Links</p>
<ol>
<li><a href="#ssr">Server-Side Rendering Strategy</a></li>
<li><a href="#ssrjs">Javascript Request and HTML Rendering Strategy</a></li>
<li><a href="#sdir">Sling Dynamic Include (SDI) Component Rendering Strategy</a></li>
</ol>
</div>
<h3 id="ssr">1. Server-Side Rendering, utilising the out of the box (OOTB) AEM experience fragment component</h3>
<p>Utilizing the OOTB experience fragment component, the experience fragment will be rendered and cached a part of the HTML page.</p>
<p><a href="https://sourcedcode.com/wp-content/uploads/2019/09/xf-component-xf-implementation.png"><img decoding="async" class="alignnone wp-image-505" src="https://sourcedcode.com/wp-content/uploads/2019/09/xf-component-xf-implementation-1024x409.png" alt="" width="450" height="180" srcset="https://sourcedcode.com/wp-content/uploads/2019/09/xf-component-xf-implementation-1024x409.png 1024w, https://sourcedcode.com/wp-content/uploads/2019/09/xf-component-xf-implementation-300x120.png 300w, https://sourcedcode.com/wp-content/uploads/2019/09/xf-component-xf-implementation-768x307.png 768w, https://sourcedcode.com/wp-content/uploads/2019/09/xf-component-xf-implementation-600x240.png 600w, https://sourcedcode.com/wp-content/uploads/2019/09/xf-component-xf-implementation.png 1116w" sizes="(max-width: 450px) 100vw, 450px" /></a></p>
<p><strong>Pros:</strong></p>
<ul>
<li>Easy to include experience fragments to editable templates and pages.</li>
</ul>
<p><strong>Cons:</strong></p>
<ul>
<li>Publishing changes for experience fragments will not automatically flush all the pages that are referencing the experience fragment.</li>
<li>For large sites, flushing all pages with the experience fragment reference may cause performance issues in the live production sites.</li>
</ul>
<p><strong>My Solution to the Cons:</strong></p>
<ul>
<li>Schedule a re-activation time for the experience fragment. The time set should be of when the site has the lowest traffic would be the best option.</li>
<li>Create a custom replication agent to invokes all the flush agent(s) that are registered within the publish instance. Flush all the pages that reference the experience fragment; adding a minor throttling mechanism if required. The mechanism should re-fetch all pages after the flush.</li>
</ul>
<hr />
<h3 id="ssrjs">2. Javascript Request and HTML Rendering</h3>
<p>Creating a custom experience fragment component that uses javascript to request for the experience fragment HTML path. On success, inject and render the experience fragment&#8217;s HTML&#8217;s structure to the page.</p>
<p><a href="https://sourcedcode.com/wp-content/uploads/2019/09/xf-js-component-xf-implementation.png"><img decoding="async" class="alignnone wp-image-506" src="https://sourcedcode.com/wp-content/uploads/2019/09/xf-js-component-xf-implementation-1024x827.png" alt="" width="450" height="363" srcset="https://sourcedcode.com/wp-content/uploads/2019/09/xf-js-component-xf-implementation-1024x827.png 1024w, https://sourcedcode.com/wp-content/uploads/2019/09/xf-js-component-xf-implementation-300x242.png 300w, https://sourcedcode.com/wp-content/uploads/2019/09/xf-js-component-xf-implementation-768x620.png 768w, https://sourcedcode.com/wp-content/uploads/2019/09/xf-js-component-xf-implementation-600x484.png 600w, https://sourcedcode.com/wp-content/uploads/2019/09/xf-js-component-xf-implementation.png 1122w" sizes="(max-width: 450px) 100vw, 450px" /></a></p>
<p><strong>Pros:</strong></p>
<ul>
<li>All pages referencing to the <span style="text-decoration: underline;">updated</span> experience fragment will not need to be flushed.</li>
<li>All pages referencing to the <span style="text-decoration: underline;">updated</span> experience fragments will surface new content on the page immediately.</li>
<li>Flushing all pages with the <span style="text-decoration: underline;">updated</span> experience fragment is not required.</li>
</ul>
<p><strong>Cons:</strong></p>
<ul>
<li>Components defined in the experience fragment that are relying on the site&#8217;s javascript will not be working as expected.</li>
</ul>
<p><strong>My Solution to the Cons:</strong></p>
<ul>
<li>Only allow experience fragments that do not rely on javascript to be allowed in the custom javascript experience fragment component; define the parsys that only allows specific components which do not depend on javascript like slideshows.</li>
</ul>
<hr />
<h3 id="sdir">3. Sling Dynamic Include (SDI) Component Rendering</h3>
<p>Sling Dynamic Include replaces specific and defined components with different types of include tags (apache include tags) and therefore allows to put dynamic content into a page cached by the dispatcher.</p>
<p>Configure Sling Dynamic Include on both AEM Publish and Apache Web Servers. The SDI AEM install exposes an OSGI configuration that allows you to target specific components that will be converted to SDI include tags in the publish mode. When a page is being requested from the Apache Web Server, the resolved page with the SDI include tag will request the JCR path from the targeted components (experience fragment), and will cache the HTML in the webserver. The page with SDI include tags will include the experience fragment HTML (cached) to the final rendered page. In summary, the render of the final page will include the experience fragment as one HTML file.</p>
<p><a href="https://sourcedcode.com/wp-content/uploads/2019/09/sdi-xf-implementation.png"><img loading="lazy" decoding="async" class="alignnone wp-image-507" src="https://sourcedcode.com/wp-content/uploads/2019/09/sdi-xf-implementation-1024x909.png" alt="" width="450" height="399" srcset="https://sourcedcode.com/wp-content/uploads/2019/09/sdi-xf-implementation-1024x909.png 1024w, https://sourcedcode.com/wp-content/uploads/2019/09/sdi-xf-implementation-300x266.png 300w, https://sourcedcode.com/wp-content/uploads/2019/09/sdi-xf-implementation-768x682.png 768w, https://sourcedcode.com/wp-content/uploads/2019/09/sdi-xf-implementation-600x533.png 600w, https://sourcedcode.com/wp-content/uploads/2019/09/sdi-xf-implementation.png 1122w" sizes="(max-width: 450px) 100vw, 450px" /></a></p>
<p><strong>Pros:</strong></p>
<ul>
<li>All pages referencing to the <span style="text-decoration: underline;">updated</span> experience fragment will not need to be flushed.</li>
<li>All pages referencing to the <span style="text-decoration: underline;">updated</span> experience fragments will surface new content on the page immediately.</li>
<li>Flushing all pages with the <span style="text-decoration: underline;">updated</span> experience fragment is not required.</li>
</ul>
<p><strong>Cons:</strong></p>
<ul>
<li>If an author unpublishes an experience fragment unexpectedly, the apache web server will display an error directly onto the page.</li>
</ul>
<p><strong>My Solution to the Cons:</strong></p>
<ul>
<li>To restrict all users from unpublishing experience fragments.</li>
<li>To create a custom approval workflow invoked in the &#8220;author&#8221; instance, where all pages referencing to the targeted unpublished experience fragment should have the experience fragment removed, and re-published; upon approval.</li>
</ul>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Horizontal Preview Ad --><br />
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-9053803095882933"
     data-ad-slot="8658919803"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<div class="mention-block">
<p><strong>Summary</strong></p>
<p>In summary, for my recommendation, it really depends on the sizing, performance uptake, and business requirements of the site. If the size of the site&#8217;s content is extra-large, then the SDI and XF Javascript options would be ideal. If the size of the site is particularly small, then flush by reference would be ideal.</p>
<p>What is your take on experience fragments and caching the most efficient (leave your comments below)?</p>
</div>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Horizontal Preview Ad #2 --><br />
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-9053803095882933"
     data-ad-slot="2263738126"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/caching-experience-fragments-with-aem-sites-6-5">Caching Experience Fragment Techniques in AEM Sites 6.5</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/caching-experience-fragments-with-aem-sites-6-5/feed</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
	</channel>
</rss>
