The Artima Developer Community
Sponsored Link

.NET Buzz Forum
My Own Cache

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Scott Watermasysk

Posts: 661
Nickname: scottwater
Registered: Aug, 2003

Scott Watermasysk is an ASP.NET developers. He wrote the .Text blog engine.
My Own Cache Posted: Oct 7, 2003 8:23 PM
Reply to this message Reply

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
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Scott Watermasysk
Latest Posts From ScottW's ASP.NET WebLog

Advertisement

Duncan made 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();
}
}

private static Cache GetCache()
{
HttpContext context = HttpContext.Current;
if(context != null)
{
return context.Cache;
}
else
{
return HttpRuntime.Cache;
}
}
}


Read: My Own Cache

Topic: Fun with NUnit - clarification Previous Topic   Next Topic Topic: A's Get

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use