asp.net - Make Cache object expire at midnight -


i have following code:

var templist = new brandcollection();             if (httpcontext.current.cache["cacheddevicelist"] == null)             {                 templist = provider.getdevicedata(info);                 httpcontext.current.cache.insert(...);             }             else             {                 templist =              } 

cache.insert() method overloaded can set dependencies, sliding , absolute expiration. want make cache expire @ midnight. how do that? thank in advance!

absolute expiration way - it's shorthand 'this expires @ absolute point in time' opposed 'in twenty minutes now'. when put item cache, need calculate when midnight , use expiration point e.g.

var templist = new brandcollection();  if (httpcontext.current.cache["cacheddevicelist"] == null)  {      templist = provider.getdevicedata(info);       // find out when midnight taking today , adding day     datetime expirationtime = datetime.today.adddays(1)     httpcontext.current.cache.insert("cacheddevicelist", templist, null, expirationtime, noslidingexpiration, cacheitempriority.normal, null);  }  else  {     ... } 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -