Share via


DataCache.AddItemLevelCallback Method (String, DataCacheOperations, DataCacheNotificationCallback, String)

 

Adds a cache notification callback for cache operations occurring on one specific item that is stored in region. 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 AddItemLevelCallback(
    string key,
    DataCacheOperations filter,
    DataCacheNotificationCallback clientCallback,
    string region
)
public:
DataCacheNotificationDescriptor^ AddItemLevelCallback(
    String^ key,
    DataCacheOperations filter,
    DataCacheNotificationCallback^ clientCallback,
    String^ region
)
member AddItemLevelCallback : 
        key:string *
        filter:DataCacheOperations *
        clientCallback:DataCacheNotificationCallback *
        region:string -> DataCacheNotificationDescriptor
Public Function AddItemLevelCallback (
    key As String,
    filter As DataCacheOperations,
    clientCallback As DataCacheNotificationCallback,
    region As String
) As DataCacheNotificationDescriptor

Parameters

  • key
    Type: System.String

    The key used to store the object in the cache.

  • region
    Type: System.String

    The name of the region where the object is stored.

Return Value

Type: Microsoft.ApplicationServer.Caching.DataCacheNotificationDescriptor

A DataCacheNotificationDescriptor object used to identify the cache notification callback.

Remarks

Only item operations AddItem, ReplaceItem, and RemoveItem can trigger cache notifications with item-level callbacks. Specifying region operations in the filter parameter will cause an exception.

Use the DataCacheOperations enumeration in the filter parameter to specify what type of item 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.

See Also

AddItemLevelCallback Overload
DataCache Class
Microsoft.ApplicationServer.Caching Namespace

Return to top