Re: Please advise about caching

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Karl Seguin (_at_)
Date: 02/10/05


Date: Thu, 10 Feb 2005 10:44:10 -0500

Alan:
Generally I like to use OutputCache whenever possible, and storing things in
the HttpCache after. OutputCache caches the entire rendered HTML,
HttpCache.Insert/Add only chunks of data (in other words you still need to
render the output).
In IIS 6.0, outputcache is automatically hosted in the kernel which makes it
even faster. In 2.0 outputcache will be even more flexible AND allow you to
store it to the file which will let it last forever (if you wanted to).

As far as performance, the closer to the final product you can cache
(outputcache) the better. And while I typically don't harp on performance,
that's the point of caching so...

Karl

-- 
MY ASP.Net tutorials
http://www.openmymind.net/
"Alan Silver" <alan-silver@nospam.thanx> wrote in message
news:JLmJ3uERv3CCFwyT@nospamthankyou.spam...
> Hello,
>
> I tried out using the cache the other day and was impressed with the
> concept. I built myself a custom control to generate the site links,
> using an XML file for the info. I kept the XML file in the cache and
> added a dependency so it will notice when the file changes. All fine so
> far.
>
> I was reading last night about using the OutputCache page directive to
> store the page in the cache. It seems you can do this for a user control
> as well, allowing you to cache part of a page.
>
> So, my question is, which is more appropriate, using the cache manually
> or using the OutputCache page directive? Obviously each will have its
> uses, but consider the following ...
>
> I have an e-commerce site written in Classic ASP. I am looking to
> rewrite it in ASP.NET at some point. One weakness of the existing
> version is that product pages are generated dynamically from a database.
> I had been looking at a method whereby when the database is updated, the
> HTML is created for the product and written to disk, avoiding the
> necessity to hit the database each time the page is displayed.
>
> I am now wondering if it would be better to generate the HTML and store
> it in the cache. I could either write the part of the page that displays
> that product details as a custom control and use OutputCache to cache
> that control, or generate the HTML myself and add it manually to the
> cache. Either way I would need some mechanism for checking when the
> database is updated, but that's a separate issue.
>
> So, any suggestions? Anything to sway me one way or the other?
>
> One factor I would like to consider is the life of an object in the
> cache. The OutputCache directive takes a Duration parameter, which means
> that come what May, the HTML will be dropped from the cache when it
> expires 9if not sooner). If I put it in the cache manually, AFAIK it
> will stay there until it gets kicked out for lack of space. Presumably
> an object that is called often is less likely to get kicked out, so the
> HTML for the most popular products will stay in the cache the longest,
> ensuring maximum efficiency. Is this right?
>
> TIA for any comments on this long waffly post ;-)
>
> -- 
> Alan Silver
> (anything added below this line is nothing to do with me)


Relevant Pages

  • Please advise about caching
    ... I tried out using the cache the other day and was impressed with the ... I built myself a custom control to generate the site links, ... version is that product pages are generated dynamically from a database. ... I am now wondering if it would be better to generate the HTML and store ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Please advise about caching
    ... OutputCache caches the entire rendered HTML, ... the cache and writing it out. ... I'm assuming that when objects get dropped form the ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Please advise about caching
    ... I wouldn't say one will last in the cache longer than the other. ... HttpCache ... (priority, absolute vs relative time, dependencies (big one)). ... OutputCache caches the entire rendered HTML, ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: about outputcache!
    ... I had a similar problem to do with server controls being affected by the ... idea is that you shouldn't try to cache a page that has AutoPostBack events ... > I'd like to ask a question about outputcache, ... > datagrid, the datagrid displays multipage data, ...
    (microsoft.public.dotnet.general)
  • Re: large viewstate
    ... You could use the OutputCache Page Directive to cache the page processing ... > Henning Krause ...
    (microsoft.public.dotnet.framework.performance)