Try our conversational search powered by Generative AI!

How to store the results from GetContentResult() method of EPiserver Find and pass it to other blocks content.



We have news page which contains three blocks and all these make use of GetContentResult() result to display content, so how can we avoid multiple call to GetContentResult() and store the copy of it and use it for all blocks. And whenever editor adds new article to it the result should be updated again. 

Can you please guide how can we avoid multiple calls to GetContentResult()?

May 27, 2021 16:55

You can use object caching.

Edited, May 30, 2021 7:45

Hi Deepa

I'm not too sure about your use case, however GetcontentResult by default cache for 60 seconds, and not cached for editor and admin. You can increase cache duration by passing custom value into the method ( see GetContentResult method signature below) . When you have new article published, it should flush the cache as well. 

IContentResult<TContentData> GetContentResult<TContentData>(this ITypeSearch<TContentData> search, int cacheForSeconds = -1, bool cacheForEditorsAndAdmins = false) 

May 31, 2021 6:37
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.