AgilityContentRepositories - Caching Issues

Hello! I have created helpers to use within my MVC views to return AgilityContentRepositories and have been running into caching issues, where after publishing the cache is not invalidated until the app pool refreshes.

I am doing this in the following way in my code:

public static List<Company> CompanyList(string rowFilter = "", string sort = "")
var data = new AgilityContentRepository<Company>("Companies").Items(rowFilter, sort);
return data?.ToList() ?? new List<SeCompany>();

And then within a cshtml view:


Do you have any ideas about why this method would return stale data in an MVC view and if this is correct to be doing?



1 comment
  • I don't see anything in your code there that would result in getting cached results after content is updated. A common gotcha is if you have a static property being set which only executes once in the app cycle, but from the code you shared here that doesn't seem to be the case.

    Comment actions Permalink

Please sign in to leave a comment.

Didn't find what you were looking for?

New post