开发者

Donut Caching Tutorials [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 10 years ago.

开发者_运维问答Can someone point out a couple of good quality tutorials/pages for donut caching? Like everything else on the web, you can google a million things, but several of the articles I've found are a bit confusing.

I'm looking for

  1. What is donut caching
  2. When should you use it
  3. How do you implement in ASP.net


Donut caching is where you cache every thing on a page except a few dynamic regions. So you cache the doughnut but not the hole.

You should use it when most of you page is static other than 1 changable section.

You should read this on implementation advice.


  1. article by Phil Haack (asp.net mvc)
  2. article by ScottGu on asp.net weblogs
  3. implementing donut caching on wackylabs

and all this with one google search


I'm not sure that you're going to get better results by using stackoverflow as a human powered search engine. Honestly, anything that anyone here will post will be sourced from a search engine query such as this one:

http://www.bing.com/search?q=asp.net%20donut%20caching


I'm not sure I'd go so far as to call it a good tutorial but if you watch this video there's a short demo of how to write donut caching at about 36 minutes in.

How to do it boils down to:
Add output caching to your pages.
Decide what items need injecting into your cached pages before they get returned to the client.
For each item, create a static (Shared in VB) method that returns the item e.g.

Public Shared Function LoginName(ByVal context As HttpContext) As String

    Return "Welcome, " & context.User.Identity.Name

End Function

Add a Substition control to your page in the appropriate location for each item, which calls the method you just created.

<asp:Substitution runat="server" ID="LoginNameSubstitution" MethodName="LoginName" />

And you're done!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜