if you are using a boilerplate approach to maintain all your content for reference component, then here is what you can do;
- bind activation event listener to activation of just that boiler plate.
Refer following article for more details around replication listener - https://helpx.adobe.com/experience-manager/kb/ReplicationListener.html
- find pages that contains reference component pointing to boiler plate content.
- programmatically issue dispatcher flush for all those pages.
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