Donut Caching Tutorials [closed]
开发者_运维问答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
- What is donut caching
- When should you use it
- 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.
- article by Phil Haack (asp.net mvc)
- article by ScottGu on asp.net weblogs
- 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!
精彩评论