Donut Caching Tutorials [closed]
Asked Answered
S

4

6

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
Successor answered 3/11, 2009 at 15:14 Comment(0)
G
8

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.

Gerrald answered 3/11, 2009 at 15:25 Comment(3)
I've always thought the opposite: you cache the hole (or the jam, depending on the type of doughtnut :-) ) and use Substitution controls to change what's round the outside. It depends on your page layout and where the most expensive bit of your page (to build) is I suppose.Palmetto
Thanks. I think the initial explanation of the concept is what I was missing. None of the articles (listed below) really start at the high level and drill down. You start out neck deep in implementation and specific libraries.Successor
@PhilPursglove, you're thinking of "Donut Hold Caching" :-P haacked.com/archive/2009/05/12/donut-hole-caching.aspxApache
S
3
  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

Sabir answered 3/11, 2009 at 15:27 Comment(0)
A
0

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

Apache answered 3/11, 2009 at 15:23 Comment(0)
P
0

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!

Palmetto answered 3/11, 2009 at 16:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.