System.(Web.)Caching myth dispelled.

 

Another myth dispelled! Last year we had an ADNUG presentation where the presenter (name withheld to protect the innocent) claimed that one should not use the great caching classes in System.Web.Caching outside of Asp.Net.

 

For some reason this has been bugging we ever since I heard it. Probably because I think the Cache and CacheDependency classes are petty nifty and I hate to see them constrained to ASP.Net apps only.

 

Last week, I finally had a chance to get a definitive answer. Rob Howard was presenting at the architect council and I took the opportunity to find out what the deal is. After all, I might want to use caching in other apps, too, like WSE web services that don't run in IIS for example.

 

Rob's answer was just what I wanted to hear. It's fine to use the cache class outside of Asp.Net !! I'm glad it was just a myth. Now I just would like to know why they had put the caching classes under System.Web and not under System. It would certainly prevent mtyths like that from ever coming up in the first place.

Published Sunday, July 04, 2004 12:19 AM by ChristophDotNet
Filed under: ,

Comments

# re: System.Web.Caching myth dispelled.

Sunday, July 04, 2004 3:59 AM by Karsten Samaschke
You could have asked me - I would have given you the same answer. :-)

# re: System.Web.Caching myth dispelled.

Sunday, July 04, 2004 6:58 AM by Johnny Hall
The interesting question then becomes:

For what scenarios would the Caching Application Block become necessary, as it seems to duplicate much of the functionality of System.Web.Caching.

I guess if you require persistence, e.g. WinForms applications (smart clients).

Anywhere else?

# re: System.Web.Caching myth dispelled.

Friday, July 09, 2004 12:36 AM by Christoph
The answer from Michael Stuart, Mr Application Block himself (http://www.gotdotnet.com/Community/User/viewprofile.aspx?userid=00014A80BA51C5F4):

CACHE BLOCK:
This thing hasn't gotten as much traction as it should. It's a very useful block for its targets.

The HUGE difference with web Cache is that Cache Block can be used to cache cross-process, or cross-machine. You can use SQL or some other provider to cache.

Yes you can do this with Session; but you can't with Application or Cache in ASP.NET, so if you need global caching across a web farm then Cache is the way to go.

Its expiration routines are also more sophisticated.

# re: System.Web.Caching myth dispelled.

Friday, July 09, 2004 10:48 AM by Johnny Hall
Fantastic. Thanks for that.

I think I need to get familiar with caching, beyond what I already know about System.Web.Caching.

# re: System.(Web.)Caching myth dispelled.

Thursday, August 30, 2007 1:30 PM by Read this

The System.Web.Caching.Cache object is not intended for use outside ASP.NET in the .NET Framework 1.1 and in the .NET Framework 1.0

Leave a Comment

(required) 
(required) 
(optional)
(required)