AEM Dispatcher Invalidate Cache
In this blog we will discuss all about invalidate dispatcher cache and how it works to flush data. As part of this blog, we will also discuss about how to implement flush agent to clear cache.
Dispatcher Flow
Below is the overall AEM dispatcher flow:
- As shown in below inline diagram, end user or any third-party service hit site URL.
- On first place request will reach out to CDN. CDN will return required data if found in cache.
- Request will reach out to dispatcher if required response not found on CDN. Dispatcher will return required data if found in cache.
- Dispatcher will look for required data in one of the AEM publish instance which can also be called as renderers if not found in dispatcher cache.
Follow below steps to enable cache invalidation in AEM author instance:
- Traverse to author instance. In my case it is http://localhost:4502/sites.html/content
2. Click on Adobe Experience Manager icon → tools → Deployment → Replication as shown below:
3. Click on Agents on Author as highlighted below:
4. Select Dispatcher flush option as shown below:
5. Click on Edit option as highlighted below:
6. Set dispatcher URL and PORT as shown below:
http://localhost:80/dispatcher/invalidate.cache
7. Check the Enabled checkbox to enable disable flush agent. Click on OK to save the changes.
8. It will show below highlighted green color radio button on successful enable.
9. Click on Test Connection anchor link to verify connection in between dispatcher and author instance.
10. To resolve above issue, lets open dispatcher.any file and update below line to allow 127.0.0.1 address:
/cache
{
# The allowedClients section restricts the client IP addresses that are
# allowed to issue activation requests.
/allowedClients
{
# Uncomment the following to restrict activation requests to originate
# from "localhost" only.
#
#/0000
# {
# /glob "*"
# /type "deny"
# }
/0001
{
/glob "127.0.0.1"
/type "allow"
}
}
}
11. Below is the screen shot of the page and its cached timestamp.
12. Publish the home page as shown below:
13. home page will get deleted from the cache directory, as shown below, as soon as we publish the page.
14. Hit the same dispatcher home page URL in the browser:
http://practice.abc/us/en/home.html
15. It will create home page cache in the directory with latest data and timestamp as shown below:
Imran Khan, Adobe Community Advisor, AEM certified developer and Java Geek, is an experienced AEM developer with over 11 years of expertise in designing and implementing robust web applications. He leverages Adobe Experience Manager, Analytics, and Target to create dynamic digital experiences. Imran possesses extensive expertise in J2EE, Sightly, Struts 2.0, Spring, Hibernate, JPA, React, HTML, jQuery, and JavaScript.