Share via


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!

Comments

  • Anonymous
    May 28, 2003
    Good one! Thanks :)
  • Anonymous
    May 28, 2003
    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...
  • Anonymous
    May 28, 2003
    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.
  • Anonymous
    May 28, 2003
    Blue Bricks? Link?
  • Anonymous
    May 28, 2003
    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
  • Anonymous
    June 03, 2003
    The application blocks are excellent tools...would be nice if they were a bit more transparent as to what they're doing.
  • Anonymous
    August 13, 2003
    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.
  • Anonymous
    June 08, 2009
    PingBack from http://cellulitecreamsite.info/story.php?id=6048
  • Anonymous
    June 09, 2009
    PingBack from http://insomniacuresite.info/story.php?id=6810