S
Steve Franks
I'm having a difficult time trying to do some basic caching of a string
using VS.NET 2005 Beta 2.
Here's the simple snippet I'm using in a method within my ASP.NET code
behind page.
if (Cache["foo"] == null)
{
Cache.Insert("fooa", m_mystring);
}
When I step through this code, the first time this code is hit the
cache[foo] is null so it goes to the Cache.Insert. This executes fine (no
exceptions) and all is well so far.
But then the next time this page runs, cache[foo] is still null. Why is
this? At one point I saw it work so that cache[foo] returned an object when
the method was called mutiple times within the same page request. But then
when I hit refresh in the browser, the next time this method ran it was
equal to null again. It seems to go back and forth between sometimes always
being null, and sometimes finding a match but only on mutilple passes from
the same browser request. Always when you hit refresh in the browser it
comes back as null - even when I've watchd it go through the Cache.Insert
via the debugger on the previous request!
Any idea what may be going on?
Thanks,
Steve
using VS.NET 2005 Beta 2.
Here's the simple snippet I'm using in a method within my ASP.NET code
behind page.
if (Cache["foo"] == null)
{
Cache.Insert("fooa", m_mystring);
}
When I step through this code, the first time this code is hit the
cache[foo] is null so it goes to the Cache.Insert. This executes fine (no
exceptions) and all is well so far.
But then the next time this page runs, cache[foo] is still null. Why is
this? At one point I saw it work so that cache[foo] returned an object when
the method was called mutiple times within the same page request. But then
when I hit refresh in the browser, the next time this method ran it was
equal to null again. It seems to go back and forth between sometimes always
being null, and sometimes finding a match but only on mutilple passes from
the same browser request. Always when you hit refresh in the browser it
comes back as null - even when I've watchd it go through the Cache.Insert
via the debugger on the previous request!
Any idea what may be going on?
Thanks,
Steve