Invalidate cache servlet | Community
Skip to main content
New Participant
Feb 23, 2023 11:32 AM UTC
Solved

Invalidate cache servlet

I am trying to write a servlet to invalidate cache and the code is not working as the distribution request is not working

 

@Reference
private Distributor distributor;

ResourceResolver resolver = ...; // the resource resolver used for authorizing the request
String agentName = "publish";    // the name of the agent used to distribute the request

String pathToInvalidate = "/content/to/invalidate";
DistributionRequest distributionRequest = new SimpleDistributionRequest(DistributionRequestType.INVALIDATE, false, pathToInvalidate);
distributor.distribute(agentName, resolver, distributionRequest);

This is the reference code I am working on  

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
krati_garg
krati_gargAccepted solution
Employee
Feb 26, 2023 6:03 PM UTC

@kaartikn Please share the Stacktrace for troubleshooting. Hopefully you are not testing it locally, but on a AEMaaCS Environment.

Whole process is defined in below link:

https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/implementing/content-delivery/caching.html#explicit-invalidation:~:text=further%20downstream%20actions.-,Sling%20Content%20Distribution%20(SCD),-NOTE

 

This should help

 

3 replies

krati_garg
krati_gargAccepted solution
Employee
Feb 26, 2023 6:03 PM UTC

@kaartikn Please share the Stacktrace for troubleshooting. Hopefully you are not testing it locally, but on a AEMaaCS Environment.

Whole process is defined in below link:

https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/implementing/content-delivery/caching.html#explicit-invalidation:~:text=further%20downstream%20actions.-,Sling%20Content%20Distribution%20(SCD),-NOTE

 

This should help

 

Translate
DmytroPanchenk
Level 3
Sep 21, 2023 12:29 AM UTC

I am trying to do the same on the RDE in a Sandbox program, and it doesn't work.

There is no stacktrace.

The publish server receives the request and issues the one for the dispatcher (see the zipped log attached). The dispatcher receives the request, but still returns the cached content until the "max-age" expires (see the screenshot attached for the cached and non-cached output).

Translate
Umesh_Thakur
New Participant
Feb 24, 2023 4:21 AM UTC

if possible pass the stack trace

Translate