IDirectoryCache Interface |
Namespace: VirtualRadar.Interface
The IDirectoryCache type exposes the following members.
Name | Description | |
---|---|---|
CacheSubFolders |
Gets or sets a value indicating that sub-folders under Folder should also be cached.
| |
Folder |
Gets or sets the folder whose content should be cached. Setting a new folder name erases the current
cache and forces the caching on a background thread of the filesnames in the new folder.
| |
Provider |
Gets or sets the object that abstracts away the environment for testing.
|
Name | Description | |
---|---|---|
BeginRefresh |
Starts an immediate refresh of the cache.
| |
Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from IDisposable.) | |
GetFullPath |
Takes a filename without a directory and returns the full path of the file in the cache.
| |
SetConfiguration |
Assigns both Folder and CacheSubFolders simultaneously. Returns true if the
assignment triggered a refresh of the cache.
|
Name | Description | |
---|---|---|
CacheChanged |
Raised on a background after the cache has been modified in some way. It is not raised if the content of
the cache did not change.
|
This was written to cache the names of aircraft pictures in an aircraft picture folder. It was found that when the picture folder held several thousand aircraft the lookup times could be painful, so the program now uses this to cache the filenames in the folder.
The .NET FileSystemWatcher object was tested but was found to be unreliable when the aircraft picture folder was a network share, particularly when the network share was hosted on a non-Windows machine. So instead the implementation may employ a polling technique to fetch files. This can introduce the following problems:
This is not a particular problem for the intended use of the cache as users are unlikely to delete aircraft pictures once they have them and missing a new file isn't the end of the world either. Making these kinds of mistakes will only lead to the possibility of very occasional website picture glitches. However it can make this cache unsuitable for more critical purposes.
The cache can detect the following changes between polls:
It will not pick up changes to size, create time, access time or case. If the file is renamed but a new file matches the name of a file in the cache, and the renamed file has the same modified time as the cached file, and the old file is replaced with a new file that has the same modified time as the old file, then the rename will not be detected.