Disabling dispatcher cache for some pages with HTTP header

Avatar

Avatar

MaynorSong

Avatar

MaynorSong

MaynorSong

04-02-2021

This document tells that but on JSP. I wonder how to do it on a java model?

Dispatcher
View Entire Topic

Avatar

Avatar

raj_mandalapu

MVP

Avatar

raj_mandalapu

MVP

raj_mandalapu
MVP

04-02-2021

You can check the below approaches.

Enable it for the page:

If you want to disable cache for only a specific set of pages, then you can follow the below approach. in the page, properties put a checkbox, and on the selection of checkbox just load the below JSP file.

<sly data-sly-include="no-cache.jsp" />

Inside the .jsp file call no-cache code.

Enable it for components:

I recommend you to use sling dynamic include for the dynamic components, it gives a lot of advantages when we compare with other approaches. you don't need to set response headers in the sling model, all you need to do is just configuration, check below article for more information.

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