CacheDependency.CacheDependency(String[], DateTime) Constructor

Initializes a new instance of the CacheDependency class that monitors an array of paths (to files or directories) for changes and specifies a time when change monitoring begins.

Namespace: System.Web.Caching
Assembly: System.Web (in system.web.dll)

public:
CacheDependency (
	array<String^>^ filenames, 
	DateTime start
)
public CacheDependency (
	String[] filenames, 
	DateTime start
)
public function CacheDependency (
	filenames : String[], 
	start : DateTime
)
Not applicable.

Parameters

filenames

An array of paths (to files or directories) that the cached object is dependent upon. When any of these resources changes, the cached object becomes obsolete and is removed from the cache.

start

The time against which to check the last modified date of the objects in the array.

If any of the directories or files specified in the filenames parameter is not found in the file system, it is treated as missing. If a directory or file is missing when the object with the dependency is added to the Cache, the cached object will be removed from the Cache when that directory or file is created.

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.

NoteNote:

Change tracking begins immediately and is not directly based on the start parameter. Use the start parameter to pass a date and time in the past against which you want to check the last modified date of the array passed in the filenames parameter. If the last modified date of any object in the array is later than the date and time set passed in the start parameter, the cached item is removed from the Cache.

The following code example creates a CacheDependency object that passes two XML files and a DateTime.Now value when the object is included as a parameter argument in an System.Web.Caching.Cache.Insert method call.

No code example is currently available or this language may not be supported.

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show: