How to cache json response in diaptcher for content as service in aem 6.5 | Community
Skip to main content
Mario248
Level 7
Jun 27, 2022 5:23 PM UTC
Solved

How to cache json response in diaptcher for content as service in aem 6.5

I want to cache json response in dispatcher for content as service in aem 6.5. For example, I want to cache http://localhost:4503/content/we-retail/us/en/men/jcr:content/root/text.model.json. the cache works here perfectly but when if author make a content change at page level, we would want to invalidate the cache for above /content/we-retail/us/en/men/jcr:content/root/text.model.json and fetch the content from publish and get cached. Is there any way make it work at node level ?

 

As per the design it works fine if we make any change at page level. Can we make the same behavior at node or component level (in this it is text component)

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
sunil_kumar_
sunil_kumar_Accepted solution
Level 5
Jun 28, 2022 2:38 AM UTC

Hi @mario248 ,
If your flush agent is working properly, cache for http://localhost:4503/content/we-retail/us/en/men/jcr:content/root/text.model.json should be invalidated as soon as you activate page http://localhost:4503/content/we-retail/us/en/men.html If it is not happening please check  /invalidate section in your farm file and allow *.json. After adding this rule cache invalidation should work as expected. Please add rules as per your project. 

/invalidate {
	/0000 {
	     /glob "*"
	     /type "deny"
	}
	/0001 {
	     /glob "*.html"
	     /type "allow"
	}
       /0002 {
	     /glob "*.json"
	     /type "allow"
	}
}

 

2 replies

sunil_kumar_
sunil_kumar_Accepted solution
Level 5
Jun 28, 2022 2:38 AM UTC

Hi @mario248 ,
If your flush agent is working properly, cache for http://localhost:4503/content/we-retail/us/en/men/jcr:content/root/text.model.json should be invalidated as soon as you activate page http://localhost:4503/content/we-retail/us/en/men.html If it is not happening please check  /invalidate section in your farm file and allow *.json. After adding this rule cache invalidation should work as expected. Please add rules as per your project. 

/invalidate {
	/0000 {
	     /glob "*"
	     /type "deny"
	}
	/0001 {
	     /glob "*.html"
	     /type "allow"
	}
       /0002 {
	     /glob "*.json"
	     /type "allow"
	}
}

 

Translate
SantoshSai
New Participant
Jun 27, 2022 5:35 PM UTC

Hi @mario248 ,

Try this in /filter section of the dispatcher configuration

{ /type "allow" /url "/content/we-retail/us/en/men/jcr:content/root/text.model.json*" }

Hope that helps!
Regards,

Santosh

Translate
Santosh Sai