RE: Remove Things in Application State After Period?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi Lucius,

For your scenario, you want to store some shared objects in the global
Application State collecction and make it be cleared after a certain
period. I think you'd better consider using the Application Cache instead
of ApplicaitonState. The Application Cache is also a global storage of
ASP.NET application and you can store and access items into it like a
dictionary. Also, you can supply a CacheDependency for each cache item so
as to control how will the cached item expired(be removed from cache
collection). e.g.

//cache and object and supply the lifetime(to expire)
Cache.Insert("item key", objectToCache, null, DateTime.MaxValue,
TimeSpan.FromSeconds(10));

#Cache.Insert Method (String, Object, CacheDependency, DateTime, TimeSpan)
http://msdn2.microsoft.com/en-us/library/4y13wyk9.aspx

Actually, the ApplicationState is provided for backward compatibility to
original classic ASP. You can use Application Cache to replace
ApplicationState in ASP.NET application.

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.

.



Relevant Pages

  • Re: Rows returned are out of sync with the request.
    ... ('driver_connection' from cache) ... <- STORE= 1 at SQLRelay.pm line 145 ... However I suspect the signal was not delivered until the execute completed. ... Can $sth ever be already defined here? ...
    (perl.dbi.users)
  • Re: issue in sending mail by exchange account
    ... So, if it goes though the cache, it will stack up in the outbox. ... Can you please tell me how can I send by exchange account in online mode through an existing profile in which exchange account is not the default one and neither its store is default? ...
    (microsoft.public.win32.programmer.messaging)
  • Re: PowerBasic rocks!
    ... is likely to be the process of getting the data out of memory and back ... into memory - two fetches and one store - where the Harvard ... - cache memory for the data doesn't help for this particular task.. ... and you get burst mode transfers that multiply the effect. ...
    (sci.electronics.design)
  • Re: If not readdir() then what?
    ... Unfortunately, in the NFS case if there are hash collisions, under the ... sequence number when adding new entries). ... the first problem you'll run into is that ext3 doesn't store ... directories in the page cache. ...
    (Linux-Kernel)
  • Re: Progress report
    ... > STORE implicitly on the mutated slot-value. ... as that object hasn't be GC'd it's in the cache along with its sxhash the ... SYNC and everything that is STOREd that needs to be updated will be. ...
    (comp.lang.lisp)