C# Class MALClient.Shared.Managers.ImageCache

Provides methods and tools to cache images in a temporary local folder
Show file Open project: Mordonus/MALClient

Public Methods

Method Description
ClearAsync ( System.TimeSpan duration = null ) : Task

call this method to clear the entire cache.

GetCacheFileName ( Uri uri ) : string

Gets the local cache file name associated with a specified Uri.

GetFromCacheAsync ( Uri uri ) : Task

Load a specific image from the cache. If the image is not in the cache, ImageCache will try to download and store it.

GetHttpStreamToStorageFileAsync ( this uri, StorageFile targetFile ) : Task

Get the response stream returned by a HTTP get request and save it to a local file.

PerformScheduledCacheCleanup ( ) : void

Private Methods

Method Description
CreateBitmapImage ( string fileName ) : Uri
CreateHash64 ( Uri uri ) : ulong
CreateHash64 ( string str ) : ulong
EnsureFileAsync ( Uri uri ) : Task
GetCacheFolderAsync ( ) : Task
GetHttpContentAsync ( Uri uri ) : Task
ImageCache ( ) : System
IsFileOutOfDate ( StorageFile file, System.DateTime expirationDate ) : Task

Method Details

ClearAsync() public static method

call this method to clear the entire cache.
public static ClearAsync ( System.TimeSpan duration = null ) : Task
duration System.TimeSpan Use this parameter to define a timespan from now to select cache entries to delete.
return Task

GetCacheFileName() public static method

Gets the local cache file name associated with a specified Uri.
public static GetCacheFileName ( Uri uri ) : string
uri System.Uri Uri of the resource.
return string

GetFromCacheAsync() public static method

Load a specific image from the cache. If the image is not in the cache, ImageCache will try to download and store it.
public static GetFromCacheAsync ( Uri uri ) : Task
uri System.Uri Uri of the image.
return Task

GetHttpStreamToStorageFileAsync() public static method

Get the response stream returned by a HTTP get request and save it to a local file.
public static GetHttpStreamToStorageFileAsync ( this uri, StorageFile targetFile ) : Task
uri this Uri to request.
targetFile Windows.Storage.StorageFile StorageFile to save the stream to.
return Task

PerformScheduledCacheCleanup() public static method

public static PerformScheduledCacheCleanup ( ) : void
return void