Class FileCacheBase
The base file cache class.
Inherited Members
Namespace: Telerik.Windows.Controls.Map
Assembly: Telerik.Windows.Controls.DataVisualization.dll
Syntax
public abstract class FileCacheBase : MemoryCache, ICacheStorage
Constructors
FileCacheBase()
Initializes a new instance of the FileCacheBase class.
Declaration
protected FileCacheBase()
Fields
CachePathProperty
Identifies the CachePath dependency property.
Declaration
public static readonly DependencyProperty CachePathProperty
Field Value
System.Windows.DependencyProperty
|
MaxExpirationTimeProperty
Identifies the MaxExpiresTime dependency property.
Declaration
public static readonly DependencyProperty MaxExpirationTimeProperty
Field Value
System.Windows.DependencyProperty
|
MaxSizeProperty
Identifies the MaxSize dependency property.
Declaration
public static readonly DependencyProperty MaxSizeProperty
Field Value
System.Windows.DependencyProperty
|
MinExpirationTimeProperty
Identifies the MinExpiresTime dependency property.
Declaration
public static readonly DependencyProperty MinExpirationTimeProperty
Field Value
System.Windows.DependencyProperty
|
Properties
CachePath
Gets or sets the path to files for a storage. This is a dependency property.
Declaration
public string CachePath { get; set; }
Property Value
System.String
|
MaxExpirationTime
Gets or sets the maximal expiration timespan for a file in cache. This is a dependency property.
Declaration
public TimeSpan MaxExpirationTime { get; set; }
Property Value
System.TimeSpan
|
MaxSize
Gets or sets the maximal cache size for a storage. Zero value specifies unlimited cache. This is a dependency property.
Declaration
public long MaxSize { get; set; }
Property Value
System.Int64
|
MinExpirationTime
Gets or sets the minimal expiration timespan for a file in cache. This is a dependency property.
Declaration
public TimeSpan MinExpirationTime { get; set; }
Property Value
System.TimeSpan
|
Methods
CreateCacheStream(String)
Creates cache stream.
Declaration
protected abstract Stream CreateCacheStream(string fileName)
Parameters
System.String
fileName
File name. |
Returns
System.IO.Stream
Stream to saving into cache. |
Dispose()
Dispose all resources are used by the FileCacheBase.
Declaration
public void Dispose()
GetFiles(String, String)
Obtains files.
Declaration
protected abstract string[] GetFiles(string cachePath, string fileMask)
Parameters
System.String
cachePath
Cache path. |
System.String
fileMask
File mask. |
Returns
System.String[]
Array of file names. |
GetFullFilePath(String)
Returns full file path.
Declaration
protected string GetFullFilePath(string fileName)
Parameters
System.String
fileName
File name. |
Returns
System.String
Full file path. |
Load(String)
Loads the file from the storage.
Declaration
public override Stream Load(string fileName)
Parameters
System.String
fileName
File name. |
Returns
System.IO.Stream
Stream if the file exists and does not expired or null. |
Overrides
LoadAsync(String, Action<Byte[]>)
Loaded file from a cache to event arguments.
Declaration
public override void LoadAsync(string fileName, Action<byte[]> callback)
Parameters
System.String
fileName
File name. |
System.Action<System.Byte[]>
callback
Callback which should be called to return tile if it is available or null. |
Overrides
LoadFileMetadata(String)
Loads file metadata.
Declaration
protected abstract MemoryCache.ICacheRecordMetadata LoadFileMetadata(string fileName)
Parameters
System.String
fileName
File name. |
Returns
MemoryCache.ICacheRecordMetadata
ICacheRecordMetadata implementation instance. |
OnCachePathChanged(String, String)
Calls when the cache path is changed.
Declaration
protected virtual void OnCachePathChanged(string oldValue, string newValue)
Parameters
System.String
oldValue
Old path. |
System.String
newValue
New path. |
OnMaxSizeChanged()
Sets thread safety max size value.
Declaration
protected virtual void OnMaxSizeChanged()
OpenCacheStream(String)
Gets cache stream.
Declaration
protected abstract Stream OpenCacheStream(string fileName)
Parameters
System.String
fileName
File name. |
Returns
System.IO.Stream
Stream to loading from cache. |
RemoveFile(String)
Removes file from cache storage.
Declaration
protected abstract void RemoveFile(string fileName)
Parameters
System.String
fileName
File name. |
Save(String, DateTime, Byte[])
Saves the file to the storage.
Declaration
public override void Save(string fileName, DateTime expirationDate, byte[] tile)
Parameters
System.String
fileName
File name. |
System.DateTime
expirationDate
Expiration date. |
System.Byte[]
tile
Byte array which is saved to the file. |
Overrides
SaveFileMetadata(MemoryCache.ICacheRecordMetadata)
Saves file metadata.
Declaration
protected abstract void SaveFileMetadata(MemoryCache.ICacheRecordMetadata cacheRecord)
Parameters
MemoryCache.ICacheRecordMetadata
cacheRecord
Cache record metadata. |