Initializes a new instance of the CacheDependency class that monitors an array of file paths (to files or directories), an array of cache keys, or both for changes. It also makes itself dependent upon a separate instance of the CacheDependency class.

Namespace: Alachisoft.NCache.Runtime.Dependencies
Assembly: Alachisoft.NCache.Runtime (in Alachisoft.NCache.Runtime.dll) Version: 4.1.0.0 (4.1.0.0)

Syntax

C#
public CacheDependency(
	string[] fileNames,
	string[] cacheKeys,
	CacheDependency dependency
)
Visual Basic
Public Sub New ( _
	fileNames As String(), _
	cacheKeys As String(), _
	dependency As CacheDependency _
)
Visual C++
public:
CacheDependency(
	array<String^>^ fileNames, 
	array<String^>^ cacheKeys, 
	CacheDependency^ dependency
)

Parameters

fileNames
Type: array<System..::..String>[]()[][]
An array of file paths (to files or directories) that the cached object is dependent upon. When any of these resources change, the cached object becomes obsolete and is removed from the cache.
cacheKeys
Type: array<System..::..String>[]()[][]
An array of cache keys that the new object monitors for changes. When any of these cache keys change, the cached object associated with this dependency object becomes obsolete and is removed from the cache.
dependency
Type: Alachisoft.NCache.Runtime.Dependencies..::..CacheDependency
Another instance of the CacheDependency class that this instance is dependent upon.

Remarks

If any of the files or directories in the array were to change or be removed from the array, the cached item becomes obsolete and is removed from the application's [!:Cache] object.

Also, if any of the directories or files specified in the fileNames parameter is not found in the file system, they are treated as missing files. If any of them are created after the object with the dependency is added to the [!:Cache], the cached object will be removed from the [!:Cache].For example, assume that you add an object to the [!:Cache] with a dependency on the following file path: c:\stocks\xyz.dat. If that file is not found when the CacheDependency object is created, but is created later, the cached object is removed upon the creation of the xyz.dat file.

Exceptions

ExceptionCondition
System..::..ArgumentNullExceptionfileNames or cacheKeys contains a null reference (Nothing in Visual Basic).

See Also