System.Web.Caching vs. Enterprise Library Caching Block
Posted
by ESV
on Stack Overflow
See other posts from Stack Overflow
or by ESV
Published on 2008-08-22T06:07:29Z
Indexed on
2010/06/09
15:22 UTC
Read the original article
Hit count: 619
For a .NET component that will be used in both web applications and rich client applications, there seem to be two obvious options for caching: System.Web.Caching or the Ent. Lib. Caching Block.
- What do you use?
- Why?
System.Web.Caching
Is this safe to use outside of web apps? I've seen mixed information, but I think the answer is maybe-kind-of-not-really.
- a KB article warning against 1.0 and 1.1 non web app use
- The 2.0 page has a comment that indicates it's OK: http://msdn.microsoft.com/en-us/library/system.web.caching.cache(VS.80).aspx
- Scott Hanselman is creeped out by the notion
- The 3.5 page includes a warning against such use
- Rob Howard encouraged use outside of web apps
I don't expect to use one of its highlights, SqlCacheDependency, but the addition of CacheItemUpdateCallback in .NET 3.5 seems like a Really Good Thing.
Enterprise Library Caching Application Block
- other blocks are already in use so the dependency already exists
- cache persistence isn't necessary; regenerating the cache on restart is OK
Some cache items should always be available, but be refreshed periodically. For these items, getting a callback after an item has been removed is not very convenient. It looks like a client will have to just sleep and poll until the cache item is repopulated.
Memcached for Win32 + .NET client
What are the pros and cons when you don't need a distributed cache?
© Stack Overflow or respective owner