Export (0) Print
Expand All

DataCacheNotificationCallback Delegate

Represents a callback method that is to be invoked by a cache notification when one or more cache operations take place.

Namespace: Microsoft.ApplicationServer.Caching
Assembly: Microsoft.ApplicationServer.Caching.Client (in microsoft.applicationserver.caching.client.dll)

'Usage
Dim instance As New DataCacheNotificationCallback(AddressOf HandlerMethod)

public delegate void DataCacheNotificationCallback (
	string cacheName,
	string regionName,
	string key,
	DataCacheItemVersion version,
	DataCacheOperations cacheOperation,
	DataCacheNotificationDescriptor nd
)
/** @delegate */
public delegate void DataCacheNotificationCallback (
	String cacheName, 
	String regionName, 
	String key, 
	DataCacheItemVersion version, 
	DataCacheOperations cacheOperation, 
	DataCacheNotificationDescriptor nd
)

Parameters

CacheName

The name of the cache associated with the cache operation.

regionName

The name of the region associated with the cache operation. A zero-length string indicates that a specific region is not associated with the cache operation.

key

The name of the key associated with the cache operation. A zero-length string indicates that a specific cached item is not associated with the cache operation.

version

The DataCacheItemVersion of the cached object associated with the cache operation that triggered the notification. A null version indicates that a specific cached item is not associated with the cache operation.

cacheOperation

The DataCacheOperations enumeration specifying which cache event triggered the cache notification.

nd

The DataCacheNotificationDescriptor object associated with the cache notification that invoked the delegate method.

Adding a cache notification callback requires two steps. First, create a method that should be invoked when a cache notification is triggered by one or more cache operations. The method you invoke with the cache notifications must accept the same parameters as the DataCacheNotificationCallback delegate. Second, add a callback using one of the three available methods from the DataCache object: AddCacheLevelCallback, AddRegionLevelCallback, or Override:Microsoft.ApplicationServer.Caching.DataCache.AddItemLevelCallback.

noteNote
In order for your application to use notifications, you need to enable them on a named cache. Use the notificationsEnabled parameter with the New-Cache or Set-CacheConfig commands. For more information, see Cache Administration with PowerShell (Velocity).

The DataCacheNotificationDescriptor object passed to the delegate method with the nd parameter can be used to unsubscribe from the cache notification. For more information, see How to: Remove a Cache Notification Callback (Velocity).


Development Platforms

Visual Studio 2010 and later, .NET Framework 4

Target Platforms

Windows 7; Windows Server 2008 R2; Windows Server 2008 Service Pack 2; Windows Vista Service Pack 2
  https://msdn.microsoft.com/en-us/library/microsoft.applicationserver.caching.aspx 2011-08-26
Show:
© 2015 Microsoft