Determine when application cache item will timeout?

Determine when application cache item will timeout?

In ASP.NET, when storing a value in the application cache with absolute expiry is there a method to retrieve the date/time when the item will expire? The application cache item will be refreshed if expired based on user requests.

Creating an asp:Button programatically?


Add a CheckBox column to a GridView with persistence
There is a method signature on the HttContext.Cache object which allows you to specify a method to be called in the event that a Cached item is removed when you set a new Cache item.

Inheriting from an ASP.NET web control: “Element <name> is not a known element”
What is the best control to use to display items from a database?
Define yourself a method that'll allow you to process that information, whether you want it to re-submit the item to the Applcation Cache, email you about it, log it in the Event Log, whatever suits your needs..
ASP.NET : Check for click event in page_load
Hope that helps, Pascal.
Accessing Controls on page loaded in IFrame in MS CRM 4.0 using Javascript

System.IO.Directory.Exists is giving an intermittent false negative

What are some common things to consider when developing a web-based application to be sold


Not sure if I've understood your question right, but I'll give it a try: I believe there is no way to actually figure out, when a certain cache-item is going to expire.

In most scenarios, I use a delegate passed in as a parameter (CacheItemRemovedCallback) when adding objects to the cache, so I get notified when the item gets kicked out.. Hope this helps a bit..


use the CacheItemRemovedCallback; your object may get kicked from the cache earlier than you expect anyway.

94 out of 100 based on 64 user ratings 1114 reviews