Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.
SOLVED

Web Page Cache

Avatar

Level 4

Good morning,

I have Adome Aem on premise with 4 Publish machines.

 

I need to ensure that a portion of the page on a web page is not saved in the cache memory of the dispatcher servers.

I tried using experience fragments. When I edit and then publish the experience fragments it updates while the web page containing it does not, the cache memory relating to the web page of the dispatcher servers does not update.

 

How can I solve the problem.

Thank you

1 Accepted Solution

Avatar

Correct answer by
Level 9

Hi @robertol6836527 

 

If you have the challenge with implementing SDI i believe the option will be to use the client side approach . Setup an ajax request to a servlet endpoint or export the portion of page you need as part of model exporters in Json format . The particular request endpoint can be configured in dispatcher and CDN levels to no-cache and thus always you get the new result from server and render on the client side. 

eg:  under cache rules add something similar

/0104 {
# Exclusion for the dynamic content URL.
/glob "/xxx/xxx/xx*"
/type "deny"
}

View solution in original post

5 Replies

Avatar

Level 9

Hi @robertol6836527 

You can use the sling dynamic include concept. Sling Dynamic Include (SDI) is a feature of Adobe Experience Manager that allows you to dynamically include fragments of content on a page.

 

Please read the below detailed implementation on how it can by pass the dispatcher cache and serve the dynamic content.

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

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

https://medium.com/@toimrank/aem-sling-dynamic-include-9c5eb233c33c

 

Hope this helps

 

 

Avatar

Level 4

HI,

Thanks for the reply.

 

But unfortunately I cannot use the Sling Dynamic Includes (SDI), the machines are shared with multiple projects, and I have not been authorized to install the new bundle.

 

Is there an alternative route?

 

Thank you

Avatar

Correct answer by
Level 9

Hi @robertol6836527 

 

If you have the challenge with implementing SDI i believe the option will be to use the client side approach . Setup an ajax request to a servlet endpoint or export the portion of page you need as part of model exporters in Json format . The particular request endpoint can be configured in dispatcher and CDN levels to no-cache and thus always you get the new result from server and render on the client side. 

eg:  under cache rules add something similar

/0104 {
# Exclusion for the dynamic content URL.
/glob "/xxx/xxx/xx*"
/type "deny"
}

Avatar

Level 1

You can include your portion of page with plain Apache SSI directive instead of using SDI if you can't install it. It would be something like this in your html files 

<div class='whatever'>
 <!--#include virtual="${'/content/experience-fragments//whatever' @ selectors='nocache', extension='html'}" -->
</div>

 You will need as well to ensure SSI will be interpreted by Apache by configuring this in your vhost

<Directory />
...

# Add Includes to enable SSI
Options FollowSymLinks Includes

...

</Directory>

 Finally, you can add a dispatcher condition to not cache resource with 'nocache' selectors 

/001 {
    /glob "*.nocache.html*"
    /type "deny"
}

Avatar

Level 10

SDI is the only way which allow not to cache portion of page. Playing with cache will not help as you will be writing on the basis of path which will not help as page names are dynamic.

Follow below URL having step by step process to implement
https://medium.com/@toimrank/aem-sling-dynamic-include-9c5eb233c33c