Alex Lowe's .NET Blog

Taking feedback to the next level....

Simple custom cache class.....

One of the projects I'm working in is a large ASP.NET application that will have both Mobile and WinForms bits plugged into it in the future. We want to cache data but we don't want it tied to the ASP.NET cache (even if it will work now without IIS on the machine, it may not work that way in the future). So, we wrote our own simple custom cache. 

The cache is quite simple but does support time based expiration and has a polling mechanism to remove "dirty" items. There isn't anything proprietary about the class so I figured it was ok to send out in the wild. The only thing that you should look out for is that we use a custom configuration class (there are like one or two references to "ProductName.Configuration.Blah" in the code) - you will need to replace those with either hard coded values of your own or configuration items of your own.

At any rate, it's not too complicated but I thought it might be useful to someone out there so I posted it to my site. you can get the complete source for the custom cache class here and the custom cache item class here.

Much credit goes to Ben Tiedt who helped me design the spec for the class and wrote much of the code.

Enjoy!

Published Wednesday, May 28, 2003 1:29 PM by AlexLowe

Comments

 

Roy Osherove said:

Good one! Thanks :)
May 28, 2003 11:23 AM
 

Jesse Ezell said:

Well, you already have it written I guess, but the Blue Bricks team is working on a caching block that works across ASP.NET, WinForms, etc. Don't know if its up there yet...
May 28, 2003 11:33 AM
 

Alex Lowe said:

Yeah, we created it about 3 months ago - they've been quite slow to push out any new application blocks but I really like the ones that are currently available.
May 28, 2003 12:15 PM
 

chadb said:

Blue Bricks? Link?
May 28, 2003 2:49 PM
 

Alex Lowe said:

I believe Blue Bricks is the name of the group that is working on Microsoft's suite of Application Blocks: Data Access Block, Exception Management Block, and a few new ones are in the works but aren't available yet.

http://msdn.microsoft.com/practices/type/Blocks/default.asp
May 28, 2003 2:55 PM
 

Scott Galloway said:

The application blocks are excellent tools...would be nice if they were a bit more transparent as to what they're doing.
June 3, 2003 9:31 AM
 

Pradeep said:

My current project does needs this, we here were just planning to implement the Cache Factory, which I guess my seniors will not be able to do it as they have ignored me ;)). As I also had the similar idea. But my idea still is at beginning stage. Thanx for opening the source code as this thing will help me in future.
August 14, 2003 6:29 AM
 

Alex Lowe s NET Blog Simple custom cache class | Cellulite Creams said:

June 8, 2009 10:58 PM
 

Alex Lowe s NET Blog Simple custom cache class | Insomnia Cure said:

June 9, 2009 8:49 PM
Anonymous comments are disabled

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker