DataCache.AddCacheLevelCallback Method (DataCacheOperations, DataCacheNotificationCallback)
Adds a cache notification callback for cache operations occurring on all regions and items. Not supported in Windows Azure Shared Caching.
Namespace: Microsoft.ApplicationServer.Caching
Assembly: Microsoft.ApplicationServer.Caching.Client (in Microsoft.ApplicationServer.Caching.Client.dll)
Syntax
public DataCacheNotificationDescriptor AddCacheLevelCallback(
DataCacheOperations filter,
DataCacheNotificationCallback clientCallback
)
public:
DataCacheNotificationDescriptor^ AddCacheLevelCallback(
DataCacheOperations filter,
DataCacheNotificationCallback^ clientCallback
)
member AddCacheLevelCallback :
filter:DataCacheOperations *
clientCallback:DataCacheNotificationCallback -> DataCacheNotificationDescriptor
Public Function AddCacheLevelCallback (
filter As DataCacheOperations,
clientCallback As DataCacheNotificationCallback
) As DataCacheNotificationDescriptor
Parameters
filter
Type: Microsoft.ApplicationServer.Caching.DataCacheOperationsThe type of cache operation(s) that will trigger cache notifications.
clientCallback
Type: Microsoft.ApplicationServer.Caching.DataCacheNotificationCallbackThe name of the method you want to invoke when these notifications occur.
Return Value
Type: Microsoft.ApplicationServer.Caching.DataCacheNotificationDescriptor
A DataCacheNotificationDescriptor object used to identify the cache notification callback.
Remarks
Use the DataCacheOperations enumeration in the filter parameter to specify what type of item or region operations you want to trigger cache notifications. Select more than one enumeration by separating the enumerations with the binary OR operator to perform a bitwise OR. To do this, use the | character in C#, and the Or operator in Visual Basic.
The clientCallback method you invoke with the cache notification must accept the same parameters as the DataCacheNotificationCallback delegate.
Note
In order for your application to use notifications, you need to enable them on a named cache. For Windows Server AppFabric Caching, use the NotificationsEnabled parameter with the New-Cache or Set-CacheConfig Windows PowerShell commands. For Windows Azure Caching on roles, enable notifications in the cache settings.
See Also
DataCache Class
Microsoft.ApplicationServer.Caching Namespace
Return to top