Caching at Component level in AEM | Community
Skip to main content
March 14, 2021
Solved

Caching at Component level in AEM

  • March 14, 2021
  • 5 replies
  • 3454 views

What is the way of caching the components of a page. I want to achieve caching at component level. I have few components in a page and I want to make do not cache for 2 components and rest of the components to be cached.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Bhuwan_B

Please refer below articles for Sling Dynamic Include implementation:

https://www.aemquickstart.in/2016/12/sling-dynamic-include.html

https://www.argildx.com/technology/sling-dynamic-include-sdi/

 

5 replies

Vaibhavi_J
Level 7
March 14, 2021

Hi @abhi-ecm , 

It is possible through Sling Dynamic Include (SDI) where dispatcher is able to cache the whole page but dynamic components are generated and included with every request. 

Please check the below documentation for more details. 

https://github.com/wttech/Sling-Dynamic-Include

 

https://experienceleague.adobe.com/docs/experience-manager-learn/foundation/development/set-up-sling-dynamic-include.html?lang=en#development

joerghoh
Adobe Employee
Adobe Employee
March 14, 2021

For what reason do you want to implement cacching? Are these components rendered individually (outside of the context of a page) or do you want to cache the components in a way, that rendering them into the context of a page is faster?

Rohit_Utreja
Community Advisor
Community Advisor
March 14, 2021

"Sling Dynamic Include" can be used to stop caching of one or more components in the dispatcher.

 

We need to make some configurations on the AEM side and dispatcher side by providing a sling resource type of any component.

 You can refer to the below link to setup Sling Dynamic Include.

https://experienceleague.adobe.com/docs/experience-manager-learn/foundation/development/set-up-sling-dynamic-include.html?lang=en#development

 

Bhuwan_B
Community Advisor
Bhuwan_BCommunity AdvisorAccepted solution
Community Advisor
March 15, 2021
Asutosh_Jena_
Community Advisor
Community Advisor
March 15, 2021

Hi @abhi-ecm 

If you are going for SDI please refer the below links which provides in detail explanation of how the implementation will be:
https://experienceleague.adobe.com/docs/experience-manager-learn/foundation/development/set-up-sling-dynamic-include.html?lang=en#development
https://sling.apache.org/documentation/bundles/dynamic-includes.html

Please note that if you have a CDN running infront of your ALB/dispatcher, you will need to disable the HTML content caching in the CDN to make sure the request reaches the dispatcher followed by the publisher always. If the HTML content is cached in the CDN, SDI will never be able to send request to dispatcher followed by publish instance.

Hope this helps!
Thanks!