November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Hi Deepa
The GetContentResult() results are cached anyway so you are safe to use it on multiple blocks on a page.
See the caching section here: https://world.episerver.com/documentation/developer-guides/search-navigation/Integration/cms-integration/GetContentResult-and-GetFilesResult/
David
Hi David,
We raised support ticket related to this sometime back and they told don't call GetContentResult() multiple times for same page, copy those result and make use of that copy in other blocks.
Hey Deepa
I am surprised at the advice due to the fact that the documentation says the results are cached. But its likely to avoid multiple hits to the index which is good, so good to learn something new :)
Another option I have not tried is to use the TempData and populate it in the parrent controller then use it for rendering in your block. This isn't ideal as the general best practice is that blocks should be unware and therefore not dependent on the pages they are being used on.
David
Hi David,
They reverted back saying there is no harm with GetContentResult() multiple times as it will be cached. For second call cached copy will be used.
Thank you for your input on this.
Deepa
Hello,
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()?