내 커뮤니티 업적 표시줄을 확대합니다.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.

해결됨

AEM "caching JSP components"

Avatar

Level 7

Hi 

 

Following is setup of our aem environment

AEM Author -> AEM Publisher -> Dispatcher ->CDN -> userbrowser

 

user requests URL : https://company.com/content/siteone/page1.html

 

Issue:

JSP components have calls to "sling.getService()" to get data from backend sources.

Author always displaying data changes.

But dispatcher never displaying the backend data source changes unless republishing of aem pages happen again.

 

Question: Why does this happen? what are my options?

Do I need to say no-cache at service annotation level to make sure always service gets called and latest data retrieved , displayed on front end?

Do I need to do anything else at JSP component level ?

 

I apologize ,if this is a basic question but my knowledge on dispatcher , cdn is limited.

 

Thanks for any help. (I assume above issue would even happen on sightly components as well)

 

 

1 채택된 해결책 개

Avatar

정확한 답변 작성자:
Community Advisor

Hi @sreenu539 

Refer below thread and document reference to get a clue on issue and potential resolution - 

Caching in AEM as a Cloud Service | Adobe Experience Manager

Solved: AEMaaCS : Dispatcher/CDN cache - Adobe Experience League Community - 463105

<LocationMatch "^/content/.*\.(html)$">
     Header set Cache-Control "max-age=200"
     Header set Surrogate-Control "max-age=3600"
     Header set Age 0
</LocationMatch>

 

 

원본 게시물의 솔루션 보기

3 답변 개

Avatar

정확한 답변 작성자:
Community Advisor

Hi @sreenu539 

Refer below thread and document reference to get a clue on issue and potential resolution - 

Caching in AEM as a Cloud Service | Adobe Experience Manager

Solved: AEMaaCS : Dispatcher/CDN cache - Adobe Experience League Community - 463105

<LocationMatch "^/content/.*\.(html)$">
     Header set Cache-Control "max-age=200"
     Header set Surrogate-Control "max-age=3600"
     Header set Age 0
</LocationMatch>

 

 

Avatar

Employee Advisor

In your use case, it seems like component behavior is dynamic, ie. the component fetches data from some backend service and renders it. 

There are multiple ways to handle such cases:

  • Lazy loading of your component, using AJAX. Make sure to uncache this AJAX request to always get latest content from backend APIs.
  • Implement SDI (Sling Dynamic Include) [1] for your component. Read this article [2] to understand SDI.

 

[1] https://experienceleague.adobe.com/docs/experience-manager-learn/foundation/development/set-up-sling... 

[2] https://medium.com/tech-learnings/sling-dynamic-include-deep-dive-dynamically-include-page-component... 

Avatar

Employee Advisor

In your case the generated output of AEM is cached in the dispatcher. It's best practice to cache as much as possible to speed up page delivery and also to use a CDN the best way.