Delegado DataCacheNotificationCallback
Representa um método de retorno de chamada que deve ser invocado por uma notificação de cache quando uma ou mais operações de cache ocorrerem. Aplica apenas às versões de servidor do AppFabric.
Namespace: Microsoft.ApplicationServer.Caching
Assembly: Microsoft.ApplicationServer.Caching.Client (em Microsoft.ApplicationServer.Caching.Client.dll)
public delegate void DataCacheNotificationCallback( string cacheName, string regionName, string key, DataCacheItemVersion version, DataCacheOperations cacheOperation, DataCacheNotificationDescriptor nd )
Parâmetros
- cacheName
- Tipo: System..::..String
- regionName
- Tipo: System..::..String
O nome da região associada à operação de cache. Uma cadeia de comprimento zero indica que uma região específica não está associada à operação de cache.
- key
- Tipo: System..::..String
O nome da chave associada à operação de cache. Uma cadeia de comprimento zero indica que um item específico armazenado em cache não está associado à operação de cache.
- version
- Tipo: Microsoft.ApplicationServer.Caching..::..DataCacheItemVersion
A DataCacheItemVersion do objeto armazenado em cache associado à operação de cache que disparou a notificação. Uma versão nula indica que um item específico armazenado em cache não está associado à operação de cache.
- cacheOperation
- Tipo: Microsoft.ApplicationServer.Caching..::..DataCacheOperations
A enumeração DataCacheOperations que especifica qual evento de cache disparou a notificação de cache.
- nd
- Tipo: Microsoft.ApplicationServer.Caching..::..DataCacheNotificationDescriptor
O objeto DataCacheNotificationDescriptor associado à notificação de cache que invocou o método delegate.
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].
Observação |
|---|
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 .
Observação