DataCacheNotificationCallback Delegate

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Specifies the parameters required for a method to be invoked by a cache notification.

Namespace: Microsoft.Data.Caching
Assembly: ClientLibrary (in clientlibrary.dll)

Syntax

'Declaration
Public Delegate Sub DataCacheNotificationCallback ( _
    CacheName As String, _
    regionName As String, _
    key As String, _
    version As DataCacheItemVersion, _
    cacheOperation As DataCacheOperation, _
    nd As DataCacheNotificationDescriptor _
)
'Usage
Dim instance As New DataCacheNotificationCallback(AddressOf HandlerMethod)
public delegate void DataCacheNotificationCallback (
    string CacheName,
    string regionName,
    string key,
    DataCacheItemVersion version,
    DataCacheOperation cacheOperation,
    DataCacheNotificationDescriptor nd
)
public delegate void DataCacheNotificationCallback (
    String^ CacheName, 
    String^ regionName, 
    String^ key, 
    DataCacheItemVersion^ version, 
    DataCacheOperation cacheOperation, 
    DataCacheNotificationDescriptor^ nd
)
/** @delegate */
public delegate void DataCacheNotificationCallback (
    String CacheName, 
    String regionName, 
    String key, 
    DataCacheItemVersion version, 
    DataCacheOperation cacheOperation, 
    DataCacheNotificationDescriptor nd
)
JScript supports the use of delegates, but not the declaration of new ones.

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 DataCacheOperation enumeration specifying which cache event triggered the cache notification.

Remarks

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 AddItemLevelCallback.

Note

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).

See Also

Reference

Microsoft.Data.Caching Namespace