I have a strange problem with my distributed CM/CD Sitecore 8.2 environment.
Certain items and their children are published programmatically on a schedule after an automated update process. The update process deletes old children and creates new children with new IDs. This means the publish operation needs to delete the old children and create the new children on the CD at publish time.
The way these are published is using the following API call:
PublishManager.PublishItem
(
item: parentItem,
targets: dbTargetArray,
languages: langArray,
deep: true,
compareRevisions: true, // smart publish (false for republish)
publishRelatedItems: false
);
- The items and their children get correctly published.
- When pulling out the child items on the CD, some come through as null/non existent, even though we know they are there.
- E.g.
parentItem.Axes.SelectItems("./somechild/*[@@templatekey='sometemplate']"
- E.g.
- If we clear the
web[data]
cache and also theweb[items]
cache (which sits on top ofweb[data]
) on the CD the problem is immediately resolved. - If we manually republish (via the publish ribbon in Content Editor) the item, the problem is resolved.
With all this in mind, why and/or how could this happen? It's like the web[data]
cache is "stuck" thinking the child items don't exist and therefore returns null each time, which then has the knock-on effect of putting null into the web[items]
cache. Clear these 2 caches and it hits the database to get the real data, repopulates the caches and we're back in business.
Sitecore is supposed to evict items from the caches as and when they get updated, added, deleted, etc. by the publish process, but it's like it's somehow not evicting cache entries for the children that are "not found".