Expand my Community achievements bar.

SOLVED

Caching at component level in Adobe Experience Manager

Avatar

Employee

Hi, I read the following forum post: http://forums.adobe.com/message/4296426, like to get confirmation that this is how we need to implement our solution.

 

This is the problem: we have a component that displays a link to Vimeo if the user is logged in, and a link to the login screen if not logged in. The page needs to be cached for performance reasons. Now the problem is that if the page is cached, the link displayed is also cached, so doesn't change depending hte user.

 

We're using Adobe CQ authentication.

 

Is there a way to make the content behind the link non-cached?

 

Any feedback really appreciated.

1 Accepted Solution

Avatar

Correct answer by
Employee

Yes, you can refer metioned ticket as well

 

OR

 

You can try below too

 

as per your problem statement you only have to display one of the two links "Vimeo" when user logged in or Login screen when user not logged in. So would suggest to create two selectors jsps let say "logged_in.jsp" and "anonymous.jsp" apart from your component jsp let say your component is "A" then you have "A.jsp"

 

Now in A.jsp check the staus of user and make call to anyone of these jsp based on status by passing these names as selector because when selectors adds to request and it firms new url and in that way it will be not cached and server differenly.

 

<sling:include resourcType="type of component" path="path to resource" addSelectors="logged_in"/>

 

OR

 

<sling:include resourcType="type of component" path="path to resource" addSelectors="anonymous"/>

 

so above call it makes like

http://<host>:<port>/content/yourproject/yourresourcearea/A.logged_in.html

OR

http://<host>:<port>/content/yourproject/yourresourcearea/A.anonymous.html

 

Note: if addSelectors doesnt work then try replaceSelectors

View solution in original post

1 Reply

Avatar

Correct answer by
Employee

Yes, you can refer metioned ticket as well

 

OR

 

You can try below too

 

as per your problem statement you only have to display one of the two links "Vimeo" when user logged in or Login screen when user not logged in. So would suggest to create two selectors jsps let say "logged_in.jsp" and "anonymous.jsp" apart from your component jsp let say your component is "A" then you have "A.jsp"

 

Now in A.jsp check the staus of user and make call to anyone of these jsp based on status by passing these names as selector because when selectors adds to request and it firms new url and in that way it will be not cached and server differenly.

 

<sling:include resourcType="type of component" path="path to resource" addSelectors="logged_in"/>

 

OR

 

<sling:include resourcType="type of component" path="path to resource" addSelectors="anonymous"/>

 

so above call it makes like

http://<host>:<port>/content/yourproject/yourresourcearea/A.logged_in.html

OR

http://<host>:<port>/content/yourproject/yourresourcearea/A.anonymous.html

 

Note: if addSelectors doesnt work then try replaceSelectors