Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

AEM 6.2 - Pages creation with cacheable and non cacheable components.

Avatar

Level 3

Hi,

We are implementing a project using AEM 6.2 version. We are having both static & dynamic components on the page.

We are looking for option to build our components such way that entire page will be cached except the dynamic component sections(these dynamic components should render the content dynamically)

Can you anyone please let me know what will be the best solution to achieve this. 

 

Thanks in advance. 

Regards,

Kalyan

7 Replies

Avatar

Level 10

To cache AEM pages - you use Dispathcer. See: 

https://docs.adobe.com/docs/en/dispatcher.html

In AEM 6.2 - its recommended that you build your components using Sightly. 

https://docs.adobe.com/docs/en/aem/6-2/develop/sightly.html

So what controls caching is how you configure Dispatcher - not how you build components. 

Avatar

Level 8

This [1] does exactly what you need and works great.  Also see [2].

You can do it a number of ways, including by specifying a configuration in AEM for the resourceTypes to target.  It's pretty neat.

[1] https://github.com/Cognifide/Sling-Dynamic-Include

[2] https://www.cognifide.com/our-blogs/cq/sling-dynamic-include/

Avatar

Administrator

Hi

In order to accomplish a combination of static & dynamic content, You must use Sling Dynamic module. Here is the doc.

https://www.cognifide.com/our-blogs/cq/sling-dynamic-include/ (Excellent Read)

Using the sling dynamic module, You can make sections of the page non-cachable in your case it is body of the page.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

Avatar

Level 3

Thanks for quick response. We will follow the links shared by you guys. if we stuck anywhere will get back to you

Avatar

Level 3

Hi,

Can you give the sample how to Sling dynamic include tags for the dynamic components like header,footer,registration etc..,.?

Thanks & Regards,

C.Kalyan

Avatar

Level 3

Hi,

Could anyone help me is there any sample code, how to include the dynamic components in place holder

Thanks & Regards,

C.Kalyan