New to Telerik UI for WPFStart a free 30-day trial

The base file cache class.

Definition

Namespace:Telerik.Windows.Controls.Map

Assembly:Telerik.Windows.Controls.DataVisualization.dll

Syntax:

C#
public abstract class FileCacheBase : MemoryCache, ICacheStorage

Inheritance: objectMemoryCacheFileCacheBase

Derived Classes: FileSystemCacheIsolatedStorageCache

Implements: ICacheStorage

Inherited Members MemoryCache.MemoryMaxSizePropertyMemoryCache.GetTile(string)MemoryCache.GetCacheRecord(string)MemoryCache.AddToCacheRecords(MemoryCache.CacheRecord)MemoryCache.MemoryMaxSize

Constructors

Initializes a new instance of the FileCacheBase class.

C#
protected FileCacheBase()

Fields

CachePathProperty

DependencyProperty

Identifies the CachePath dependency property.

C#
public static readonly DependencyProperty CachePathProperty

MaxExpirationTimeProperty

DependencyProperty

Identifies the MaxExpiresTime dependency property.

C#
public static readonly DependencyProperty MaxExpirationTimeProperty

MaxSizeProperty

DependencyProperty

Identifies the MaxSize dependency property.

C#
public static readonly DependencyProperty MaxSizeProperty

MinExpirationTimeProperty

DependencyProperty

Identifies the MinExpiresTime dependency property.

C#
public static readonly DependencyProperty MinExpirationTimeProperty

Properties

Gets or sets the path to files for a storage. This is a dependency property.

C#
public string CachePath { get; set; }

Gets or sets the maximal expiration timespan for a file in cache. This is a dependency property.

C#
public TimeSpan MaxExpirationTime { get; set; }

Gets or sets the maximal cache size for a storage. Zero value specifies unlimited cache. This is a dependency property.

C#
public long MaxSize { get; set; }

Gets or sets the minimal expiration timespan for a file in cache. This is a dependency property.

C#
public TimeSpan MinExpirationTime { get; set; }

Methods

Creates cache stream.

C#
protected abstract Stream CreateCacheStream(string fileName)
Parameters:fileNamestring

File name.

Returns:

Stream

Stream to saving into cache.

Dispose all resources are used by the FileCacheBase.

C#
public void Dispose()

Obtains files.

C#
protected abstract string[] GetFiles(string cachePath, string fileMask)
Parameters:cachePathstring

Cache path.

fileMaskstring

File mask.

Returns:

string[]

Array of file names.

Returns full file path.

C#
protected string GetFullFilePath(string fileName)
Parameters:fileNamestring

File name.

Returns:

string

Full file path.

Loads the file from the storage.

C#
public override Stream Load(string fileName)
Parameters:fileNamestring

File name.

Returns:

Stream

Stream if the file exists and does not expired or null.

Overrides: MemoryCache.Load(string)

Loaded file from a cache to event arguments.

C#
public override void LoadAsync(string fileName, Action<byte[]> callback)
Parameters:fileNamestring

File name.

callbackAction<byte[]>

Callback which should be called to return tile if it is available or null.

Overrides: MemoryCache.LoadAsync(string, Action<byte[]>)

Loads file metadata.

C#
protected abstract MemoryCache.ICacheRecordMetadata LoadFileMetadata(string fileName)
Parameters:fileNamestring

File name.

Returns:

MemoryCache.ICacheRecordMetadata

ICacheRecordMetadata implementation instance.

Calls when the cache path is changed.

C#
protected virtual void OnCachePathChanged(string oldValue, string newValue)
Parameters:oldValuestring

Old path.

newValuestring

New path.

Sets thread safety max size value.

C#
protected virtual void OnMaxSizeChanged()

Gets cache stream.

C#
protected abstract Stream OpenCacheStream(string fileName)
Parameters:fileNamestring

File name.

Returns:

Stream

Stream to loading from cache.

Removes file from cache storage.

C#
protected abstract void RemoveFile(string fileName)
Parameters:fileNamestring

File name.

Saves the file to the storage.

C#
public override void Save(string fileName, DateTime expirationDate, byte[] tile)
Parameters:fileNamestring

File name.

expirationDateDateTime

Expiration date.

tilebyte[]

Byte array which is saved to the file.

Overrides: MemoryCache.Save(string, DateTime, byte[])

Saves file metadata.

C#
protected abstract void SaveFileMetadata(MemoryCache.ICacheRecordMetadata cacheRecord)
Parameters:cacheRecordMemoryCache.ICacheRecordMetadata

Cache record metadata.