Hi @jakecham
Sure, I'd be happy to explain those ways to clear the Dispatcher cache in AEM.
- Custom code to do the flush through programming using API end point: You can use the /bin/flushmanager.html endpoint in AEM to programmatically clear the Dispatcher cache. Here's an example of how you might do this using curl
curl -u username:password "AEM_PUBLISH_URL/bin/flushmanager.html?cmd=flushall" 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.
- using statfileslevel property through cache section: The statfileslevel property in the dispatcher.any file determines how often the Dispatcher checks the timestamps of the .stat files in the cache. By default, this property is set to 0, which means that the Dispatcher checks the .stat files every time a request is made. However, you can set this property to a higher value (e.g. 1) to reduce the frequency of these checks and improve performance.
- Here's an example of how you might use this property:
/cache {
/statfileslevel 1
}
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.