Share via


DataCache.AddCacheLevelCallback Method

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

Adds a cache notification callback for cache operations occurring on all regions and items.

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

Syntax

'Declaration
Public Overridable Function AddCacheLevelCallback ( _
    filter As DataCacheOperation, _
    clientCallback As DataCacheNotificationCallback _
) As DataCacheNotificationDescriptor
'Usage
Dim instance As DataCache
Dim filter As DataCacheOperation
Dim clientCallback As DataCacheNotificationCallback
Dim returnValue As DataCacheNotificationDescriptor

returnValue = instance.AddCacheLevelCallback(filter, clientCallback)
public virtual DataCacheNotificationDescriptor AddCacheLevelCallback (
    DataCacheOperation filter,
    DataCacheNotificationCallback clientCallback
)
public:
virtual DataCacheNotificationDescriptor^ AddCacheLevelCallback (
    DataCacheOperation filter, 
    DataCacheNotificationCallback^ clientCallback
)
public DataCacheNotificationDescriptor AddCacheLevelCallback (
    DataCacheOperation filter, 
    DataCacheNotificationCallback clientCallback
)
public function AddCacheLevelCallback (
    filter : DataCacheOperation, 
    clientCallback : DataCacheNotificationCallback
) : DataCacheNotificationDescriptor

Parameters

  • filter
    The type of cache operation(s) that will trigger cache notifications.
  • clientCallback
    The name of the method you want to invoke when these notifications occur.

Return Value

A DataCacheNotificationDescriptor object used to identify the cache notification callback.

Remarks

Use the DataCacheOperation 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.

For more information about using this method, see How to: Add a Cache Notification Callback (Velocity). For more information about cache notifications, see Cache Notifications (Velocity).

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

See Also

Reference

DataCache Class
DataCache Members
Microsoft.Data.Caching Namespace