Class
FileCacheBase

The base file cache class.

Definition

Namespace:Telerik.Windows.Controls.Map

Assembly:Telerik.Windows.Controls.DataVisualization.dll

Syntax:

cs-api-definition
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

FileCacheBase()

Initializes a new instance of the FileCacheBase class.

Declaration

cs-api-definition
protected FileCacheBase()

Fields

CachePathProperty

Identifies the CachePath dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty CachePathProperty

Field Value

DependencyProperty

MaxExpirationTimeProperty

Identifies the MaxExpiresTime dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty MaxExpirationTimeProperty

Field Value

DependencyProperty

MaxSizeProperty

Identifies the MaxSize dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty MaxSizeProperty

Field Value

DependencyProperty

MinExpirationTimeProperty

Identifies the MinExpiresTime dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty MinExpirationTimeProperty

Field Value

DependencyProperty

Properties

CachePath

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

Declaration

cs-api-definition
public string CachePath { get; set; }

Property Value

string

MaxExpirationTime

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

Declaration

cs-api-definition
public TimeSpan MaxExpirationTime { get; set; }

Property Value

TimeSpan

MaxSize

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

Declaration

cs-api-definition
public long MaxSize { get; set; }

Property Value

long

MinExpirationTime

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

Declaration

cs-api-definition
public TimeSpan MinExpirationTime { get; set; }

Property Value

TimeSpan

Methods

CreateCacheStream(string)

Creates cache stream.

Declaration

cs-api-definition
protected abstract Stream CreateCacheStream(string fileName)

Parameters

fileName

string

File name.

Returns

Stream

Stream to saving into cache.

Dispose()

Dispose all resources are used by the FileCacheBase.

Declaration

cs-api-definition
public void Dispose()

GetFiles(string, string)

Obtains files.

Declaration

cs-api-definition
protected abstract string[] GetFiles(string cachePath, string fileMask)

Parameters

cachePath

string

Cache path.

fileMask

string

File mask.

Returns

string[]

Array of file names.

GetFullFilePath(string)

Returns full file path.

Declaration

cs-api-definition
protected string GetFullFilePath(string fileName)

Parameters

fileName

string

File name.

Returns

string

Full file path.

Load(string)

Loads the file from the storage.

Declaration

cs-api-definition
public override Stream Load(string fileName)

Parameters

fileName

string

File name.

Returns

Stream

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

Overrides MemoryCache.Load(string)

LoadAsync(string, Action<byte[]>)

Loaded file from a cache to event arguments.

Declaration

cs-api-definition
public override void LoadAsync(string fileName, Action<byte[]> callback)

Parameters

fileName

string

File name.

callback

Action<byte[]>

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

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

LoadFileMetadata(string)

Loads file metadata.

Declaration

cs-api-definition
protected abstract MemoryCache.ICacheRecordMetadata LoadFileMetadata(string fileName)

Parameters

fileName

string

File name.

Returns

MemoryCache.ICacheRecordMetadata

ICacheRecordMetadata implementation instance.

OnCachePathChanged(string, string)

Calls when the cache path is changed.

Declaration

cs-api-definition
protected virtual void OnCachePathChanged(string oldValue, string newValue)

Parameters

oldValue

string

Old path.

newValue

string

New path.

OnMaxSizeChanged()

Sets thread safety max size value.

Declaration

cs-api-definition
protected virtual void OnMaxSizeChanged()

OpenCacheStream(string)

Gets cache stream.

Declaration

cs-api-definition
protected abstract Stream OpenCacheStream(string fileName)

Parameters

fileName

string

File name.

Returns

Stream

Stream to loading from cache.

RemoveFile(string)

Removes file from cache storage.

Declaration

cs-api-definition
protected abstract void RemoveFile(string fileName)

Parameters

fileName

string

File name.

Save(string, DateTime, byte[])

Saves the file to the storage.

Declaration

cs-api-definition
public override void Save(string fileName, DateTime expirationDate, byte[] tile)

Parameters

fileName

string

File name.

expirationDate

DateTime

Expiration date.

tile

byte[]

Byte array which is saved to the file.

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

SaveFileMetadata(ICacheRecordMetadata)

Saves file metadata.

Declaration

cs-api-definition
protected abstract void SaveFileMetadata(MemoryCache.ICacheRecordMetadata cacheRecord)

Parameters

cacheRecord

MemoryCache.ICacheRecordMetadata

Cache record metadata.