Class CacheDependency
Tracks cache dependencies, which can be files, directories, or keys to other objects in application's Cache. This class cannot be inherited.
Inheritance
Namespace:
Assembly: Alachisoft.NCache.Runtime.dll
Syntax
[Serializable]
public class CacheDependency : IDisposable
Remarks
You can add items with dependencies to your application's cache with the System.Web.Caching.Cache.Add(System.String,System.Object,System.Web.Caching.CacheDependency,System.DateTime,System.TimeSpan,System.Web.Caching.CacheItemPriority,System.Web.Caching.CacheItemRemovedCallback) and Insert methods.
When you add an item to an application's System.Web.Caching.Cache object and in doing so define a cache dependency for that item, an instance of the CacheDependency class is created automatically to track changes to the files, keys, or directories you have specified. This helps you avoid losing changes made to the object between the time it is created and the time it is inserted into the cache. The CacheDependency instance can represent a single file or directory, an array of files or directories, or an array of files or directories along with an array of cache keys (these represent other items stored in the Cache object).
Constructors
Name | Description |
---|---|
CacheDependency() | Default constructor for CacheDependency class |
CacheDependency(CustomDependency) | Creates a CacheDependency instance from custom dependency. |
CacheDependency(ExtensibleDependency) | Creates a CacheDependency instance from extensible dependency. |
CacheDependency(String) | Initializes a new instance of the CacheDependency class that monitors a file or directory for changes. |
CacheDependency(String, DateTime) | Initializes a new instance of the CacheDependency class that monitors a file or directory for changes and indicates when change tracking is to begin. |
CacheDependency(String[]) | Initializes a new instance of the CacheDependency class that monitors an array of file paths (to files or directories) for changes. |
CacheDependency(String[], DateTime) | Initializes a new instance of the CacheDependency class that monitors an array of file paths (to files or directories) for changes and specifies a time when change monitoring begins. |
CacheDependency(String[], String[]) | 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. |
CacheDependency(String[], String[], CacheDependency) | 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. |
CacheDependency(String[], String[], CacheDependency, DateTime) | 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 another instance of the CacheDependency class and a time when the change monitoring begins. |
CacheDependency(String[], String[], DateTime) | 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. |
Properties
Name | Description |
---|---|
Dependencies | Contains the List of Dependencies for the Cache Item |
Methods
Name | Description |
---|---|
AddDependencies(CacheDependency[]) | AddDependencies is use to Add dependencies for the Cache Item |
DependencyDispose() | Release custom resources used by the CacheDependency object. |
Dispose() | Releases the resources used by the CacheDependency object. |