CacheBase<T> Class

Definition

Provides methods and tools to cache files in a folder

public abstract class CacheBase<T>
type CacheBase<'T> = class
Public MustInherit Class CacheBase(Of T)

Type Parameters

T

Generic type as supplied by consumer of the class

Inheritance
CacheBase<T>
Derived

Constructors

CacheBase<T>()

Initializes a new instance of the CacheBase<T> class.

Properties

CacheDuration

Gets or sets the life duration of every cache entry.

HttpClient

Gets instance of HttpClient

MaxMemoryCacheCount

Gets or sets max in-memory item storage count

RetryCount

Gets or sets the number of retries trying to ensure the file is cached.

Methods

ClearAsync()

Clears all files in the cache

ClearAsync(TimeSpan)

Clears file if it has expired

GetFileFromCacheAsync(Uri)

Gets the StorageFile containing cached item for given Uri

GetFromCacheAsync(Uri, Boolean, CancellationToken, List<KeyValuePair<String,Object>>)

Retrieves item represented by Uri from the cache. If the item is not found in the cache, it will try to downloaded and saved before returning it to the caller.

GetFromMemoryCache(Uri)

Retrieves item represented by Uri from the in-memory cache if it exists and is not out of date. If item is not found or is out of date, default instance of the generic type is returned.

InitializeAsync(StorageFolder, String, HttpMessageHandler)

Initializes FileCache and provides root folder and cache folder name

InitializeTypeAsync(StorageFile, List<KeyValuePair<String,Object>>)

Cache specific hooks to process items from HTTP response

InitializeTypeAsync(Stream, List<KeyValuePair<String,Object>>)

Cache specific hooks to process items from HTTP response

IsFileOutOfDateAsync(StorageFile, TimeSpan, Boolean)

Override-able method that checks whether file is valid or not.

PreCacheAsync(Uri, Boolean, Boolean, CancellationToken)

Assures that item represented by Uri is cached.

RemoveAsync(IEnumerable<Uri>)

Removed items based on uri list passed

RemoveExpiredAsync(Nullable<TimeSpan>)

Removes cached files that have expired

Applies to