// Update the parent after child
markUptodate(getId(), cacheCheckTime, upToDateRoot);
}
private void markUptodate(String key, long time, CachedNodeDocument upToDateRoot) {
CachedNodeDocument doc = documentStore.getCachedNodeDoc(key);
if (doc == null) {
return;
}
// Only mark the cachedDoc up-to-date if
// 1. it got created i.e. cached document creation
// time is greater or same as the time of the root node on which markUptodate
// is invoked. As in typical cache population child node would be added
// later than the parent.
// If the creation time is less then it means that parent got replaced/updated later
// and hence its _lastRev property would not truly reflect the state of child nodes
// present in cache
// 2. OR Check if both documents have been marked up-to-date in last cycle. As in that case
// previous cycle would have done the required checks
if (doc.getCreated() >= upToDateRoot.getCreated()
|| doc.getLastCheckTime() == upToDateRoot.getLastCheckTime()) {
doc.markUpToDate(time);
}
}