We are looking to create/use a reference type component, my question is what process have people used before to manage dispatcher cache invalidation for when the component that has been referenced is updated to ensure that all pages where it has been referenced on are also invalidated on the dispatcher? asking users to republish these pages manually is not really an option for us.
Solved! Go to Solution.
if you are using a boilerplate approach to maintain all your content for reference component, then here is what you can do;
Refer following article for more details around replication listener - https://helpx.adobe.com/experience-manager/kb/ReplicationListener.html
Reference code for programmatically flushing the cache:
PostMethod post = new PostMethod("http://localhost:80/dispatcher/invalidate.cache");
post.setRequestHeader("CQ-Action", "Activate");
post.setRequestHeader("CQ-Handle",handle);
if (StringUtils.isNotBlank(pagePath))
{
StringRequestEntity body = new StringRequestEntity(pagePath,null,null);
post.setRequestEntity(body);
post.setRequestHeader("Content-length", String.valueOf(body.getContentLength()));
}
Above code does what dispatcher flush agent does, it basically issues programmatic cache-flush request for specific pagePaths
Hope this helps :)
- Runal
if you are using a boilerplate approach to maintain all your content for reference component, then here is what you can do;
Refer following article for more details around replication listener - https://helpx.adobe.com/experience-manager/kb/ReplicationListener.html
Reference code for programmatically flushing the cache:
PostMethod post = new PostMethod("http://localhost:80/dispatcher/invalidate.cache");
post.setRequestHeader("CQ-Action", "Activate");
post.setRequestHeader("CQ-Handle",handle);
if (StringUtils.isNotBlank(pagePath))
{
StringRequestEntity body = new StringRequestEntity(pagePath,null,null);
post.setRequestEntity(body);
post.setRequestHeader("Content-length", String.valueOf(body.getContentLength()));
}
Above code does what dispatcher flush agent does, it basically issues programmatic cache-flush request for specific pagePaths
Hope this helps :)
- Runal
Views
Likes
Replies