0
votes

Donut Caching and Donut Hole caching is not very clear to me. i read few article on this and those urls are

https://www.dotnettricks.com/learn/mvc/donut-caching-and-donut-hole-caching-with-aspnet-mvc-4 https://www.c-sharpcorner.com/UploadFile/chinnasrihari/Asp-Net-mvc-framework-donut-donut-hole-caching/ http://dotnet-helpers.com/mvc/donut-caching-with-asp-net-mvc/

1) when people use Donut Caching then they should use [DonutOutputCache(Duration=60)] for action instead of [OutputCache(Duration=60)] but if anyone check the links which i have pasted here then must notice people use OutputCache attribute instead of DonutOutputCache but this reason not clear to me.

2) if i need to cache partial view then i need to use OutputCache instead of DonutOutputCache or OutputCache actually will use DonutOutputCache internally.

3) if i mention cache location at client side then when another client from different pc visit my same cache page then what will happen? i guess if i maintain cache at client side then for next visitor again db trip will occur and cache the data and store at client side......am i right?

Sorry my English is not good. thanks so please some one clarify these above 2 points. thanks

1

1 Answers

1
votes

1) The combination of Outputcache along with the ChildActionOnly attribute is akin to Donut HOLE caching. The hole of the donut is not rerendered, it is served from the cache. By using the ChildActionOnly attribute, then specifying the OutputCache attribute and time, you are saying cache this part of the donut hole on the server for the specified Duration. the donut hole it will serve from the cache. You have to use them both. Please see a good example: http://www.tugberkugurlu.com/archive/donut-hole-caching-in-asp-net-mvc-by-using-child-actions-and-outputcacheattribute

2) To cache a partial view output, we again use an OutputCache attribute to the action method IN THE CONTROLLER that returns partial view result. Please see http://techfunda.com/howto/275/cache-partial-view-output

3) When using OutputCacheLocation.Client the output cache is located on the browser client where the request originated. Each new visitor that comes in on their first request of the page has that page content cached in their browser.