When you have weakreference field on a content (for instance related events on a publication, and the events should display the publication) and you change the weakreference to another event the cache is not flushed. Scenario:
The problem is the second source is already cached and a publication of the weakreference don't flush the cache because the cacheDependeny is set to late (just on the first call of the weakreference).
A solution for this would be to add a simple drools rule to flush the related cache like:
rule "flush related event cache"
salience 25
when
A node is published
- the node has the type jnt:publication
then
> if (node.getNode().getProperty("relatedEvent") != null ) {
> org.jahia.services.cache.CacheHelper.flushOutputCachesForPath(node.getNode().getProperty("relatedEvent").getNode().getPath(), true);
> }
end