Hi Team,
I'm checking on ways of clear the dispatcher cache in AEM and I will list the ways I know .. Please explain more about them as well as anything else ...
Thanks in advance!
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @JakeCham
Sure, I'd be happy to explain those ways to clear the Dispatcher cache in AEM.
This command will clear the entire Dispatcher cache for the AEM publish instance.
Through dispatcher flush agent: AEM provides a built-in flush agent that can be used to clear the Dispatcher cache. You can enable this agent by setting the DISPATCHER_FLUSH_AGENT parameter to true in the agent.properties file of your AEM instance. Once enabled, the flush agent will clear the Dispatcher cache whenever a page is activated or deactivated.
using invalidate property through cache section: You can use the invalidate property in the dispatcher.any file to specify which files or pages should be cleared from the Dispatcher cache when a page is activated or deactivated. Here's an example of how you might use this property:
/cache/invalidate {
/0000 {
/glob "*"
/type "allow"
}
}
This configuration will clear all files in the Dispatcher cache when a page is activated or deactivated.
This configuration will tell the Dispatcher to check the .stat files every 5 seconds, instead of every request.
I hope that helps! Let me know if you have any other questions.
Hi @JakeCham
Custom Code: Within AEM, you can write custom code to programmatically invalidate or flush a specific Dispatcher cache item. This usually involves leveraging Adobe's HTTP API to carry out a specific HTTP action, which is POST, and pass specific arguments like ":action=InvalidateDispatcherCache". The cache item URL is part of the POST call.
Dispatcher Flush Agent: flush agents in AEM are another key method. A flush agent is set up on Author to "detect" when certain content is activated (or deactivated), then triggers the Dispatcher to flush the associated cache item. To set this up, you must go to Tools => Operations => Web Console (or Tools => Operations => Replication) to configure your flush agent. This is a built-in feature of AEM.
Invalidate property in the cache section of Dispatcher: Another way to manage cache is through Dispatcher's configuration file, dispatcher.any. In the /cache section, there's 'invalidate' property, which controls whether Dispatcher should automatically drop related cached files when an incoming request modifies the content on the publish instance. It's good for managing cache globally and systematically.
Statfileslevel property in the cache section of Dispatcher: 'statfileslevel' is another property listed in the /cache section of the dispatcher.any file. It controls the directory level at which the Dispatcher writes the .stat files. The .stat file is used to define the time at which the cache was last adjusted. If Dispatcher receives an activation request, or the statfile is newer than the cache file, the cached file is re-requested from the publish instance.
Also you can write a schedular to clear the cashe on everyday bases.
Thanks,
Venkat
ACS Commons to clear dispatcher cache:
https://medium.com/@toimrank/enable-or-disable-dispatcher-cache-9ce071810420
Custom cache clearance using Distribution request
DistributionRequest distributionRequest = new SimpleDistributionRequest(requestType,
isDeep, pathsToInvalidate.toArray(new String[0]));
if (!pathsToInvalidate.isEmpty()) {
DistributionResponse distributionResponse = distributor.distribute(agent,
resolver, distributionRequest);
LOGGER.debug("Distribution message: {}", distributionResponse.getMessage());
}
You can also use acs-commons dispatcher flush to clear the cache. It has 2 options invalidate and delete the cache.
https://adobe-consulting-services.github.io/acs-aem-commons/features/dispatcher-flush-ui/index.html
Do you have experience using this in production on an AEMaaCS instance? Curious how well it works for ad-hoc dispatcher flushes.
Were you able to find any solution for the ACS ?
Hi @JakeCham
This will provide you with additional information regarding flush strategies.
Deep-dive into AEM dispatcher’s cache flush strategies
Thanks
@JakeCham Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.
Views
Replies
Total Likes
Hi @JakeCham
Sure, I'd be happy to explain those ways to clear the Dispatcher cache in AEM.
This command will clear the entire Dispatcher cache for the AEM publish instance.
Through dispatcher flush agent: AEM provides a built-in flush agent that can be used to clear the Dispatcher cache. You can enable this agent by setting the DISPATCHER_FLUSH_AGENT parameter to true in the agent.properties file of your AEM instance. Once enabled, the flush agent will clear the Dispatcher cache whenever a page is activated or deactivated.
using invalidate property through cache section: You can use the invalidate property in the dispatcher.any file to specify which files or pages should be cleared from the Dispatcher cache when a page is activated or deactivated. Here's an example of how you might use this property:
/cache/invalidate {
/0000 {
/glob "*"
/type "allow"
}
}
This configuration will clear all files in the Dispatcher cache when a page is activated or deactivated.
This configuration will tell the Dispatcher to check the .stat files every 5 seconds, instead of every request.
I hope that helps! Let me know if you have any other questions.
Views
Likes
Replies
Views
Likes
Replies