2

I have an odd issue that seems to be related to caching but I've never seen this before.

Sitecore.Context.Item.Fields["OfficeContacts"].Value is returning a different value from Sitecore.Context.Database.GetItem(Sitecore.Context.Item.ID).Fields["OfficeContacts"].Value

We're frequently getting the wrong content on the site- after content editors publish changes, they do not show up in SOME user sessions but show up correctly in other sessions. It seems random. I've gotten the obsolete data in an incognito session, and the updated data in my regular Chrome session. Seems to have nothing to do with whether the user has visited the site before, as colleagues who have never been to the site saw the old content when testing. This is reproducable on lower environments.

When reproducing the issue on my local, my debugging revealed Sitecore.Context.Item.Fields["OfficeContacts"].Value returned the obsolete value, which DOES NOT match what is visible in the web database raw values. However, Sitecore.Context.Database.GetItem(Sitecore.Context.Item.ID).Fields["OfficeContacts"].Value, in the same session and same Watch window, DOES return the correct data.

What would cause Sitecore.Context.Item to cache or return old data?

7
  • Separate CD CM, one CD Commented Apr 12, 2023 at 16:59
  • When you say obsolete value, do you mean a previous value that was assigned to item? Or a value from a different item than expected? Commented Apr 12, 2023 at 20:39
  • The former, the previous value before publishing Commented Apr 12, 2023 at 20:49
  • When you check this item in the web database, how many item versions are shown in the versions dropdown? If you see more than one, it can be caused by content testing. Commented Apr 12, 2023 at 20:57
  • What is your setting for eventQueueProvider? Is it eventQueueProvider defaultEventQueue="web"? And what about <setting name="EnableEventQueues"?
    – Marek Musielak
    Commented Apr 13, 2023 at 9:37

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.