DataCacheNotificationCallback Delegate

Represents a callback method that is to be invoked by a cache notification when one or more cache operations take place. Applies only to the server versions of AppFabric.

Namespace:  Microsoft.ApplicationServer.Caching
Assembly:  Microsoft.ApplicationServer.Caching.Client (in Microsoft.ApplicationServer.Caching.Client.dll)

Syntax

'Declaration
Public Delegate Sub DataCacheNotificationCallback ( _
    cacheName As String, _
    regionName As String, _
    key As String, _
    version As DataCacheItemVersion, _
    cacheOperation As DataCacheOperations, _
    nd As DataCacheNotificationDescriptor _
)
'Usage
Dim instance As New DataCacheNotificationCallback(AddressOf HandlerMethod)
public delegate void DataCacheNotificationCallback(
    string cacheName,
    string regionName,
    string key,
    DataCacheItemVersion version,
    DataCacheOperations cacheOperation,
    DataCacheNotificationDescriptor nd
)
public delegate void DataCacheNotificationCallback(
    String^ cacheName, 
    String^ regionName, 
    String^ key, 
    DataCacheItemVersion^ version, 
    DataCacheOperations cacheOperation, 
    DataCacheNotificationDescriptor^ nd
)
type DataCacheNotificationCallback = 
    delegate of 
        cacheName:string * 
        regionName:string * 
        key:string * 
        version:DataCacheItemVersion * 
        cacheOperation:DataCacheOperations * 
        nd:DataCacheNotificationDescriptor -> unit
JScript supports the use of delegates, but not the declaration of new ones.

Parameters

  • regionName
    Type: System. . :: . .String
    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
    Type: System. . :: . .String
    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.

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(DataCacheOperation, DataCacheNotificationCallback), AddRegionLevelCallback(String, DataCacheOperation, DataCacheNotificationCallback), or [Override:Microsoft.ApplicationServer.Caching.DataCache.AddItemLevelCallback].

Note

In order for your application to use notifications, you need to enable them on a named cache. In Microsoft AppFabric 1.1 for Windows Server Caching, use the notificationsEnabled parameter with the New-Cache or Set-CacheConfig Windows PowerShell commands. In Windows Azure Caching, enable notifications in the Caching configuration of the role that hosts the cache.

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 .

See Also

Reference

Microsoft.ApplicationServer.Caching Namespace