MemoryCache::CreateCacheEntryChangeMonitor Method
Creates a CacheEntryChangeMonitor object that can trigger events in response to changes to specified cache entries.
Assembly: System.Runtime.Caching (in System.Runtime.Caching.dll)
public: virtual CacheEntryChangeMonitor^ CreateCacheEntryChangeMonitor( IEnumerable<String^>^ keys, String^ regionName ) override
Parameters
- keys
- Type: System.Collections.Generic::IEnumerable<String>
An enumeration of unique cache entry keys for the CacheEntryChangeMonitor object.
- regionName
- Type: System::String
A named region in the cache to which a cache entry can be added. Do not pass a value for this parameter. This parameter is nullptr by default, because the MemoryCache class does not implement regions.
Return Value
Type: System.Runtime.Caching::CacheEntryChangeMonitorA change monitor that monitors entries in the cache.
| Exception | Condition |
|---|---|
| NotSupportedException | regionName is not nullptr. |
| ArgumentNullException | keys is nullptr. |
| ArgumentException | The number of items in keys is zero. |
| ArgumentException | An item in the keys collection is nullptr. |
The CreateCacheEntryChangeMonitor method creates a CacheEntryChangeMonitor instance. This specialized change monitor is used to monitor the cache entries that are specified in the keys collection and to trigger events when the entries change.
A monitored entry is considered to have changed for any of the following reasons:
The key does not exist at the time of the call to the CreateCacheEntryChangeMonitor method. In that case, the resulting CacheEntryChangeMonitor instance is immediately set to a changed state. This means that when code subsequently binds a change-notification callback, the callback is triggered immediately.
The associated cache entry was removed from the cache. This can occur if the entry is explicitly removed, if it expires, or if it is evicted to recover memory
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.