com.alachisoft.jvcache.runtime.dependencies
Class CacheDependency

java.lang.Object
  extended by com.alachisoft.jvcache.runtime.dependencies.CacheDependency
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AggregateCacheDependency, DBCacheDependency, ExtensibleDependency, FileDependency, KeyDependency, OracleCacheDependency

public class CacheDependency
extends java.lang.Object
implements java.io.Serializable

Tracks cache dependencies, which can be files, directories, or keys to other objects in application's Cache. This class cannot be inherited.

You can add items with dependencies to your application's cache with the Add and Insert methods. When you add an item to an application's 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).

See Also:
Serialized Form

Constructor Summary
CacheDependency()
           
CacheDependency(ExtensibleDependency extensibleDependency)
          Creates a CacheDependency instance from extensible dependency.
CacheDependency(java.lang.String fileName)
          Initializes a new instance of the CacheDependency class that monitors a file or directory for changes.
CacheDependency(java.lang.String[] fileNames)
          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(java.lang.String[] fileNames, java.util.Date start)
          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(java.lang.String[] fileNames, java.lang.String[] cacheKeys)
          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(java.lang.String[] fileNames, java.lang.String[] cacheKeys, CacheDependency dependency)
          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(java.lang.String[] fileNames, java.lang.String[] cacheKeys, CacheDependency dependency, java.util.Date start)
          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(java.lang.String[] fileNames, java.lang.String[] cacheKeys, java.util.Date start)
          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(java.lang.String fileName, java.util.Date start)
          Initializes a new instance of the CacheDependency class that monitors a file or directory for changes and indicates when change tracking is to begin.
 
Method Summary
 void dispose()
          Releases the resources used by the "CacheDependency" object.
 java.util.List<CacheDependency> getDependencies()
          Get Dependencies
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheDependency

public CacheDependency()

CacheDependency

public CacheDependency(ExtensibleDependency extensibleDependency)
Creates a CacheDependency instance from extensible dependency.

Parameters:
extensibleDependency -

CacheDependency

public CacheDependency(java.lang.String fileName)
                throws ArgumentException
Initializes a new instance of the CacheDependency class that monitors a file or directory for changes.

If the directory or file specified in the fileName parameter is not found in the file system, it will be treated as a missing file. If the file is 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.

Parameters:
fileName - The path to a file or directory that the cached object is dependent upon. When this resource changes, the cached object becomes obsolete and is removed from the cache.
Throws:
ArgumentException

CacheDependency

public CacheDependency(java.lang.String fileName,
                       java.util.Date start)
                throws ArgumentException
Initializes a new instance of the CacheDependency class that monitors a file or directory for changes and indicates when change tracking is to begin.

Parameters:
fileName - The path to a file or directory that the cached object is dependent upon. When this resource changes, the cached object becomes obsolete and is removed from the cache.
start - The time when change tracking begins.
Throws:
ArgumentException

CacheDependency

public CacheDependency(java.lang.String[] fileNames)
                throws ArgumentException
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.

Parameters:
fileNames - 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.
Throws:
ArgumentException

CacheDependency

public CacheDependency(java.lang.String[] fileNames,
                       java.util.Date start)
                throws ArgumentException
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.

Parameters:
fileNames - 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.
start - The time when change tracking begins.
Throws:
ArgumentException

CacheDependency

public CacheDependency(java.lang.String[] fileNames,
                       java.lang.String[] cacheKeys)
                throws ArgumentException
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.

Parameters:
fileNames - 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 - 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.
Throws:
ArgumentException

CacheDependency

public CacheDependency(java.lang.String[] fileNames,
                       java.lang.String[] cacheKeys,
                       java.util.Date start)
                throws ArgumentException
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.

Parameters:
fileNames - 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 - 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.
start - The time when change tracking begins.
Throws:
ArgumentException

CacheDependency

public CacheDependency(java.lang.String[] fileNames,
                       java.lang.String[] cacheKeys,
                       CacheDependency dependency)
                throws ArgumentException
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.

Parameters:
fileNames - 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 - 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 - Another instance of the CacheDependency class that this instance is dependent upon.
Throws:
ArgumentException

CacheDependency

public CacheDependency(java.lang.String[] fileNames,
                       java.lang.String[] cacheKeys,
                       CacheDependency dependency,
                       java.util.Date start)
                throws ArgumentException
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.

Parameters:
fileNames - 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 - 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 - Another instance of the CacheDependency class that this instance is dependent upon.
start - The time when change tracking begins.
Throws:
ArgumentException
Method Detail

getDependencies

public java.util.List<CacheDependency> getDependencies()
Get Dependencies

Returns:
List

dispose

public void dispose()
Releases the resources used by the "CacheDependency" object.