The base directory where the cache is stored.
Base directory where the cache is stored. Default value is null.
Certain type of caches, such as, FileCache, requires a directory on disk to store the cache items. This directory is usually stored in FileCache.CacheDirectory. After this, the cache requires a full path to this directory to perform its operations. Therefore, one of the following is performed:
The user sets a full path in CacheDirectory. In this case, no further action is required (BaseDirectory is not used).
The user sets a relative path in CacheDirectory. In this case, the cache object will inquire the value of BaseDirectory as follows:
If the value of BaseDirectory is null, then the cache object will use the operating system default behavior to resolve the full path to CacheDirectory
. Usually resulting in a full path relative to where the current directory is or where application .dll or .exe bin folder resides.
In some situations, such as a web service, the above is not possible, therefore, the user can set BaseDirectory
to a path on the system and the cache object will combine BaseDirectory
+ CacheDirectory
to create the full path of the directory. This is especially important in Java services where access to random directories on disk is not usually supported.
In all cases, the ResolveDirectory method is called internally by the cache object every time a directory full path to an item is required. This method will perform the exact actions described above to return the full path to the file or directory queried.