Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Wed, 23 Jul 2008 15:21:01 -0700,    group: microsoft.public.dotnet.framework.aspnet.caching        back       


Setting auto expiring cache from app_code folder   
I would like to store an object in cache for precisely one hour and then it 
expires. I have tried the following code but it seems to disappear after 
20mins...

HttpContext.Current.Cache.Add("bloggedAPI_Blocked_" + strEmail, myobject, 
null, DateTime.Now.AddHours(1), System.Web.Caching.Cache.NoSlidingExpiration,
System.Web.Caching.CacheItemPriority.NotRemovable, null); 

I need to set this from a method in my app_code folder and am wondering if 
its something to do with HttpContext.Current erasing the cache when the 
session times out?

Anybody know where I am going wrong?
Paul.
date: Wed, 23 Jul 2008 15:21:01 -0700   author:   Paul Hale am

RE: Setting auto expiring cache from app_code folder   
Further testing and it seems that this does work intermittently. I’m guessing 
that maybe the asp.net application is restarting periodically which is 
causing the cached items to get lost. 

Is there a way I can tell when a specific application has restarted without 
having to put code in global.asx? event viewer perhaps?


"Paul Hale" wrote:

> I would like to store an object in cache for precisely one hour and then it 
> expires. I have tried the following code but it seems to disappear after 
> 20mins...
> 
> HttpContext.Current.Cache.Add("bloggedAPI_Blocked_" + strEmail, myobject, 
> null, DateTime.Now.AddHours(1), System.Web.Caching.Cache.NoSlidingExpiration,
> System.Web.Caching.CacheItemPriority.NotRemovable, null); 
> 
> I need to set this from a method in my app_code folder and am wondering if 
> its something to do with HttpContext.Current erasing the cache when the 
> session times out?
> 
> Anybody know where I am going wrong?
> Paul.
>
date: Thu, 24 Jul 2008 04:04:00 -0700   author:   Paul Hale am

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us