Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Output cache is not (always) reset when publishing a page

Vote:
 

I am experiencing som odd behaviour with the cached query results when using GetPagesResult() or GetContentResult(). Accoring to the documentation the cache search result when using GetContentResult() is linked to episerver master cache key meaning that when a page is published the cache should be reset and the query should give an updated result. This would seem it not working 100%.

It almost seems like the cache reset is not consistant. Sometimes publishing a page will reset the cache and sometimes it will not. It is very inconsistant. We do not use any custom caching and we do not use EPiServer Find caching method StaticallyCacheFor(X).

The search result is displayed in a block without any [ContentOutputCache] attribute set. The [ContentOutputCache] attribute is placed on the Index method of the page controller.


Any tips or similar experiences? I have tried both GetPagesResult() and GetContentResult() without noticing any difference in terms of caching.

 

 

 

#82121
Mar 05, 2014 16:42
Vote:
 

In case it might help figuring out the bug my query looks like something this:

if (currentBlock.CategoryFilter.Any())
                {
                    query = query.Filter(a => a.NewsCategory.Match(currentBlock.CategoryFilter[0]));
                    foreach (int categoryId in currentBlock.CategoryFilter)
                    {
                        query = query.OrFilter(a => a.NewsCategory.Match(categoryId));
                    }
                }

                List<NewsArticlePage> newsPages = query.FilterForVisitor()
                    .Take(500)
                    .GetContentResult()
                    .ToList();

#82124
Mar 05, 2014 16:51
Vote:
 

When using GetContentResult(), a 60 second cache is added by default for non-editors and non-admins.  However, just as you mentioned, this has a dependency to the master cache. When you see these inconsistencies, have you checked if the index is updated with the correct values? As a test, you could try using .GetContentResult(0)

#82333
Edited, Mar 11, 2014 9:25
* 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.