javaaemsightly

Using HTL to get class data into webpage, not showing without invalidate cache


I am using htl on AEM to get some data from java class and put them into my html. But the problem is for some time the page is not updating the data.I need to wait some time or I need to do invalidation cache on dispatcher manually. Is this normal on AEM? or there is a reason that's happening?

<html data-sly-use.page="com.a.a.a.models.EModel">

<a>Page ${page.number}</a>

This is my code but I know that the code is not my problem.

Thanks


Solution

  • AEM (Adobe Experience Manager) is a web content/experience management platform. It allows creating and managing webpages/experiences at scale. To ensure fast delivery of the published pages it uses aggressive caching and is therefore not very friendly OOTB for dynamically updated/generated pages. Documentation on how the dispatcher and CDN caching works is available at https://experienceleague.adobe.com/docs/experience-manager-dispatcher/using/dispatcher.html

    There are several strategies you can use to add dynamic data into your webpage, each with PROs/CONs:

    1. Invalidate caching for pages that need to be updated. This could be automated and linked to desired events, AEM already does automatic invalidation in some situations.
    2. Disable caching or reduce expiration time. This would allow you to obtain fresh results sooner but will put more pressure on the publisher/rendering resources.
    3. Redesign your page to render a template/placeholder and load data dynamically/asynchronously from a data source (where disabling caching will not incur a bit performance penalty as re-rendering the whole page).