views:

269

answers:

2

Hi all,

So, I've cached a value using the ASP.NET Cache object, with the following code:

Cache.Insert("TEST_VALUE", 150, null, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(120));

As I understand it, this should mean that if nothing accesses that object for 120 seconds, it will expire and return null.

However, if after 10 minutes I run a page which writes out that value from the cache, it's still there. I know there's nothing else accessing it because this is all on a local server on my machine.

Am I just not getting how this should work, or have I missed something else?

+1  A: 

That is a correct assumption on your part. Where are you doing the caching?

The reason that I ask is that if you are doing it in the Global.asax, in Application_Start, for example, and the application is being recycled between page views, it would exhibit this same behavior.

joseph.ferris
A: 

I am doing the caching from within an HttpModule.

Mark B