CacheItemUpdateCallback CacheItemUpdateCallback CacheItemUpdateCallback CacheItemUpdateCallback Delegate

Definition

Defines a callback method for notifying applications before a cached item is removed from the cache.

public delegate void CacheItemUpdateCallback(System::String ^ key, CacheItemUpdateReason reason, [Runtime::InteropServices::Out] System::Object ^ % expensiveObject, [Runtime::InteropServices::Out] CacheDependency ^ % dependency, [Runtime::InteropServices::Out] DateTime % absoluteExpiration, [Runtime::InteropServices::Out] TimeSpan % slidingExpiration);
public delegate void CacheItemUpdateCallback(string key, CacheItemUpdateReason reason, out object expensiveObject, out CacheDependency dependency, out DateTime absoluteExpiration, out TimeSpan slidingExpiration);
type CacheItemUpdateCallback = delegate of string * CacheItemUpdateReason *  *  *  *  -> unit
Public Delegate Sub CacheItemUpdateCallback(key As String, reason As CacheItemUpdateReason, ByRef expensiveObject As Object, ByRef dependency As CacheDependency, ByRef absoluteExpiration As DateTime, ByRef slidingExpiration As TimeSpan)

Parameters

key
String String String String

The identifier of the item that is being removed from the cache.

reason
CacheItemUpdateReason CacheItemUpdateReason CacheItemUpdateReason CacheItemUpdateReason

The reason that the item is being removed from the cache.

expensiveObject
Object Object Object Object

When this method returns, contains the cached item object that contains the updates.

dependency
CacheDependency CacheDependency CacheDependency CacheDependency

When this method returns, contains the object that defines the dependency between the item object and a file, a cache key, an array of either, or another CacheDependency object.

absoluteExpiration
DateTime DateTime DateTime DateTime

When this method returns, contains the time at which the object expired.

slidingExpiration
TimeSpan TimeSpan TimeSpan TimeSpan

When this method returns, contains the interval between the time that the object was last accessed and the time at which the object expired.

Inheritance
CacheItemUpdateCallbackCacheItemUpdateCallbackCacheItemUpdateCallbackCacheItemUpdateCallback

Remarks

When an object expires in the cache, ASP.NET calls the CacheItemUpdateCallback method with the key for the cache item and the reason you might want to update the item. The remaining parameters of this method are out parameters. You supply the new cached item and optional expiration and dependency values to use when refreshing the cached item.

The update callback is not called if the cached item is explicitly removed by using a call to Remove.

If you want the cached item to be removed from the cache, you must return null in the expensiveObject parameter. Otherwise, you return a reference to the new cached data by using the expensiveObject parameter. If you do not specify expiration or dependency values, the item will be removed from the cache only when memory is needed.

If the callback method throws an exception, ASP.NET suppresses the exception and removes the cached value.

Extension Methods

GetMethodInfo(Delegate) GetMethodInfo(Delegate) GetMethodInfo(Delegate) GetMethodInfo(Delegate)

Gets an object that represents the method represented by the specified delegate.

Applies to