Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Invalidate cache servlet

Avatar

Level 1

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  

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

@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/conten...

 

This should help

 

View solution in original post

3 Replies

Avatar

Correct answer by
Employee Advisor

@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/conten...

 

This should help

 

Avatar

Level 4

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).