Defines a callback method for notifying applications when a cached item is removed from the Cache.
Assembly: System.Web (in System.Web.dll)
public delegate void CacheItemRemovedCallback( string key, object value, CacheItemRemovedReason reason )
The key that is removed from the cache.
The following code example demonstrates a page that shows users the value assigned to an item in the cache and then notifies them when the item is removed from the cache. It creates a RemovedCallback method, which uses the signature of the delegate, to notify users when the cache item is removed and uses the CacheItemRemovedReason enumeration to tell them why it was removed. In addition, it uses the Cache.Item property to add objects to the cache and retrieve the value of those objects. In the AddItemToCache method, it uses the Cache.Add method to add an item to the cache. To use the delegate, you must add an item to the cache with this method or the Cache.Insert method so that that ASP.NET can automatically make the proper method calls when the item is removed. The custom RemoveItemFromCache method uses the Cache.Remove method to explicitly delete the item from the cache, causing the RemovedCallback method to be invoked.
Available since 1.1