<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Why Does My ASP.NET Cache Keep Clearing Itself?</title>
	<atom:link href="http://johnsadventures.com/archives/2006/02/why_does_my_aspnet_cache_keep_clearing_i/feed/" rel="self" type="application/rss+xml" />
	<link>http://johnsadventures.com/archives/2006/02/why_does_my_aspnet_cache_keep_clearing_i/</link>
	<description>The personal website of John Conners, a Scotsman living in Yorkshire who loves photography and writes software for a living</description>
	<lastBuildDate>Tue, 07 Feb 2012 05:45:03 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Ming</title>
		<link>http://johnsadventures.com/archives/2006/02/why_does_my_aspnet_cache_keep_clearing_i/comment-page-1/#comment-58288</link>
		<dc:creator>Ming</dc:creator>
		<pubDate>Wed, 24 Aug 2011 21:46:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.johnsadventures.com/wp/archives/2006/02/why-does-my-aspnet-cache-keep-clearing-itself.html#comment-58288</guid>
		<description>I&#039;m glad that I found this. I had the same problem and ready to give up until I found this post. I solved my problem. I&#039;m using.Net framework 4.</description>
		<content:encoded><![CDATA[<p>I&#8217;m glad that I found this. I had the same problem and ready to give up until I found this post. I solved my problem. I&#8217;m using.Net framework 4.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Conners</title>
		<link>http://johnsadventures.com/archives/2006/02/why_does_my_aspnet_cache_keep_clearing_i/comment-page-1/#comment-11688</link>
		<dc:creator>John Conners</dc:creator>
		<pubDate>Fri, 17 Oct 2008 12:33:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.johnsadventures.com/wp/archives/2006/02/why-does-my-aspnet-cache-keep-clearing-itself.html#comment-11688</guid>
		<description>The thing you have to watch with that approach (which is to store your cache in the global application object) is that it&#039;s no longer thread safe - which the global cache is - so you&#039;d have to ensure that you lock reads and writes if you want it to hold up to real world usage. Of course it all depends on your individual requirements what you go with!</description>
		<content:encoded><![CDATA[<p>The thing you have to watch with that approach (which is to store your cache in the global application object) is that it&#8217;s no longer thread safe &#8211; which the global cache is &#8211; so you&#8217;d have to ensure that you lock reads and writes if you want it to hold up to real world usage. Of course it all depends on your individual requirements what you go with!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: .NETDeveloper</title>
		<link>http://johnsadventures.com/archives/2006/02/why_does_my_aspnet_cache_keep_clearing_i/comment-page-1/#comment-11670</link>
		<dc:creator>.NETDeveloper</dc:creator>
		<pubDate>Fri, 17 Oct 2008 01:40:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.johnsadventures.com/wp/archives/2006/02/why-does-my-aspnet-cache-keep-clearing-itself.html#comment-11670</guid>
		<description>I&#039;ve given up on the ASP.NET cache object and have gone to a custom solution that uses an application variable instead of the cache object....

Something like this:

private class AppCache
  public Expires as datetime
  public Data as object
end class

then, in the code, it works looks something like this...

dim appvar as AppCache
dim mydataelement as someclass
appvar = application(&quot;AppCache&quot;)

if appvar is nothing orelse appvar.expires &lt;= datetime.now then
  &#039;Either the application variable isn&#039;t set, or it has expired
  &#039;Run your refresh here....
else
  mydataelement = ctype(appvar.Data,someclass)
end if

I&#039;ve found through extensive load and stress testing that this method uses just a little more CPU to maintain, but a lot less memory, and you don&#039;t have to worry so much about IIS killing off older objects.

Also, you might be able to mitigate some of your issues by setting a recycle frequency on your app pools.  This really isn&#039;t optimal, but it can help remediate cache issues without overriding the garbage collection routines IIS does to clean up after itself.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve given up on the ASP.NET cache object and have gone to a custom solution that uses an application variable instead of the cache object&#8230;.</p>
<p>Something like this:</p>
<p>private class AppCache<br />
  public Expires as datetime<br />
  public Data as object<br />
end class</p>
<p>then, in the code, it works looks something like this&#8230;</p>
<p>dim appvar as AppCache<br />
dim mydataelement as someclass<br />
appvar = application(&#8220;AppCache&#8221;)</p>
<p>if appvar is nothing orelse appvar.expires &lt;= datetime.now then<br />
  &#8216;Either the application variable isn&#8217;t set, or it has expired<br />
  &#8216;Run your refresh here&#8230;.<br />
else<br />
  mydataelement = ctype(appvar.Data,someclass)<br />
end if</p>
<p>I&#8217;ve found through extensive load and stress testing that this method uses just a little more CPU to maintain, but a lot less memory, and you don&#8217;t have to worry so much about IIS killing off older objects.</p>
<p>Also, you might be able to mitigate some of your issues by setting a recycle frequency on your app pools.  This really isn&#8217;t optimal, but it can help remediate cache issues without overriding the garbage collection routines IIS does to clean up after itself.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Muhammad Yousaf Sulahria</title>
		<link>http://johnsadventures.com/archives/2006/02/why_does_my_aspnet_cache_keep_clearing_i/comment-page-1/#comment-11657</link>
		<dc:creator>Muhammad Yousaf Sulahria</dc:creator>
		<pubDate>Thu, 16 Oct 2008 13:44:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.johnsadventures.com/wp/archives/2006/02/why-does-my-aspnet-cache-keep-clearing-itself.html#comment-11657</guid>
		<description>Thank guru you saved my lot of time, i was working with subsonic and trying to cache it but in debug break point the cache object immediately on next line return the null object. i thought this is the problem of subsonic and i wasted lot of time searching for subsonic fixes.then some how i thought that may b this the problem with the cache and i came to your article via google and my problem is solved thank you very much for this information.</description>
		<content:encoded><![CDATA[<p>Thank guru you saved my lot of time, i was working with subsonic and trying to cache it but in debug break point the cache object immediately on next line return the null object. i thought this is the problem of subsonic and i wasted lot of time searching for subsonic fixes.then some how i thought that may b this the problem with the cache and i came to your article via google and my problem is solved thank you very much for this information.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arco</title>
		<link>http://johnsadventures.com/archives/2006/02/why_does_my_aspnet_cache_keep_clearing_i/comment-page-1/#comment-10978</link>
		<dc:creator>Arco</dc:creator>
		<pubDate>Wed, 01 Oct 2008 14:59:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.johnsadventures.com/wp/archives/2006/02/why-does-my-aspnet-cache-keep-clearing-itself.html#comment-10978</guid>
		<description>After experiencing problems where my cache keeps being invalidated I stumbled on your post here. It solved it.
Thanx!</description>
		<content:encoded><![CDATA[<p>After experiencing problems where my cache keeps being invalidated I stumbled on your post here. It solved it.<br />
Thanx!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ben</title>
		<link>http://johnsadventures.com/archives/2006/02/why_does_my_aspnet_cache_keep_clearing_i/comment-page-1/#comment-1462</link>
		<dc:creator>ben</dc:creator>
		<pubDate>Thu, 27 Sep 2007 17:35:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.johnsadventures.com/wp/archives/2006/02/why-does-my-aspnet-cache-keep-clearing-itself.html#comment-1462</guid>
		<description>John you are THE debugging champion...thanks a ton !
</description>
		<content:encoded><![CDATA[<p>John you are THE debugging champion&#8230;thanks a ton !</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: belial</title>
		<link>http://johnsadventures.com/archives/2006/02/why_does_my_aspnet_cache_keep_clearing_i/comment-page-1/#comment-1461</link>
		<dc:creator>belial</dc:creator>
		<pubDate>Mon, 27 Aug 2007 00:52:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.johnsadventures.com/wp/archives/2006/02/why-does-my-aspnet-cache-keep-clearing-itself.html#comment-1461</guid>
		<description>dude, i luv you, been fighting with this behavior like 3 months
</description>
		<content:encoded><![CDATA[<p>dude, i luv you, been fighting with this behavior like 3 months</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bob</title>
		<link>http://johnsadventures.com/archives/2006/02/why_does_my_aspnet_cache_keep_clearing_i/comment-page-1/#comment-1460</link>
		<dc:creator>Bob</dc:creator>
		<pubDate>Tue, 03 Jul 2007 23:18:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.johnsadventures.com/wp/archives/2006/02/why-does-my-aspnet-cache-keep-clearing-itself.html#comment-1460</guid>
		<description>Please advise where your roadside shrine is located so that I may deposit fruit and nuts. You&#039;ve saved me chucking my (weak) staging box out the window.
</description>
		<content:encoded><![CDATA[<p>Please advise where your roadside shrine is located so that I may deposit fruit and nuts. You&#8217;ve saved me chucking my (weak) staging box out the window.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Bonner</title>
		<link>http://johnsadventures.com/archives/2006/02/why_does_my_aspnet_cache_keep_clearing_i/comment-page-1/#comment-1459</link>
		<dc:creator>Dave Bonner</dc:creator>
		<pubDate>Fri, 29 Jun 2007 09:40:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.johnsadventures.com/wp/archives/2006/02/why-does-my-aspnet-cache-keep-clearing-itself.html#comment-1459</guid>
		<description>You&#039;re a star.

This has been puzzling me for ages as my development website was running slooooow.

Well done figuring this out - and thanks!
</description>
		<content:encoded><![CDATA[<p>You&#8217;re a star.</p>
<p>This has been puzzling me for ages as my development website was running slooooow.</p>
<p>Well done figuring this out &#8211; and thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Conners</title>
		<link>http://johnsadventures.com/archives/2006/02/why_does_my_aspnet_cache_keep_clearing_i/comment-page-1/#comment-1458</link>
		<dc:creator>John Conners</dc:creator>
		<pubDate>Wed, 15 Feb 2006 19:08:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.johnsadventures.com/wp/archives/2006/02/why-does-my-aspnet-cache-keep-clearing-itself.html#comment-1458</guid>
		<description>John: I&#039;ll get round to reading that book soon, I swear it!

Andy: Sometimes I think that it&#039;s me on the dark side and you on the righteous path to enlightenment!
</description>
		<content:encoded><![CDATA[<p>John: I&#8217;ll get round to reading that book soon, I swear it!</p>
<p>Andy: Sometimes I think that it&#8217;s me on the dark side and you on the righteous path to enlightenment!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced
Object Caching 325/326 objects using disk: basic

Served from: johnsadventures.com @ 2012-02-11 07:23:05 -->
