This post originated from an RSS feed registered with .NET Buzz
by Scott Watermasysk.
Original Post: My Own Cache
Feed Title: ScottW's ASP.NET WebLog
Feed URL: /error.aspx?aspxerrorpath=/blog/rss.aspx
Feed Description: ASP.NET and Blogging
Duncanmade a post about what seems to be a little known fact: You can use Cache outside of a web application. Included in his post is a quick example about how to use Cache by calling HttpRuntime.Cache.
Looking through the comments, you will see a neat GotDotNet sample by Michael Bouck on creating a custom cache object which has no dependency on IIS.
Playing around a minute or two in SnippetCompiler, I came up with my own simple custom cache, which should allow you to take advantage of many Caching features:
using System;
using System.Web;
using System.Web.Caching;
public class MyCache
{
private MyCache(){}
public static Cache Cache
{
get
{
return GetCache();
}
}