November Happy Hour will be moved to Thursday December 5th.

IContentRepository - Work after clearing cache

Vote:
 

Hi,

Inspired by the this arcticle, I've created a setting page.

At first it worked perfectly but I noticed that at some point in time, the contentrepository return is null when I tryed to retreive the page:

 [AcceptVerbs(HttpVerbs.Get)]
public ActionResult GetSettings(DealerLocationRequestParameter parameter)
{
   var settings = _contentRepository.GetChildren(ContentReference.RootPage).FirstOrDefault();
   [...]
}

If I switch my web browser in private mode (or clean the web browser cache manually), it works again.

How can I fix it ? What is in cache that created this issue ?

Thanks,

#194712
Edited, Jun 28, 2018 16:13
Vote:
 

Hmm, If it works when opening up a new browser or clears the browser then it is not that call to content repository that returns null but rather some client side caching that gets stale. You could verify that by having a breakpoint in the above code.

#194725
Jun 29, 2018 5:17
Vote:
 

That's it how I figured it out. The variable "settings" above, is null if I don't clear the cache. undecided

#194745
Jun 29, 2018 17:12
Vote:
 

HI - I am having the same issue. Can you please advise?

#206258
Aug 08, 2019 18:38
Vote:
 

Make sure you have created the settings page in every language you are using. Easy to forget. Alternatively, change the above code to always get settings page in master language. 

#206295
Aug 12, 2019 15:39
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.