Table of Contents

Class RelativeTimeMixin

Namespace
Akavache
Assembly
Akavache.Core.dll

A set of extension methods that assist with setting expiration times based on increments from the current time.

public static class RelativeTimeMixin
Inheritance
RelativeTimeMixin

Methods

DownloadUrl(IBlobCache, string, TimeSpan, Dictionary<string, string>?, bool)

Downloads the specified url if there is not already a entry in the cache.

public static IObservable<byte[]> DownloadUrl(this IBlobCache blobCache, string url, TimeSpan expiration, Dictionary<string, string>? headers = null, bool fetchAlways = false)

Parameters

blobCache IBlobCache

The blob cache to insert the item into.

url string

The URL to download if not already in the cache.

expiration TimeSpan

A timespan that will be added to the current DateTime.

headers Dictionary<string, string>

The headers to specify when getting the entry.

fetchAlways bool

If we should fetch always and not return the cache entry if available.

Returns

IObservable<byte[]>

A observable which will signal when the data is available.

DownloadUrl(IBlobCache, Uri, TimeSpan, Dictionary<string, string>?, bool)

Downloads the specified url if there is not already a entry in the cache.

public static IObservable<byte[]> DownloadUrl(this IBlobCache blobCache, Uri url, TimeSpan expiration, Dictionary<string, string>? headers = null, bool fetchAlways = false)

Parameters

blobCache IBlobCache

The blob cache to insert the item into.

url Uri

The URL to download if not already in the cache.

expiration TimeSpan

A timespan that will be added to the current DateTime.

headers Dictionary<string, string>

The headers to specify when getting the entry.

fetchAlways bool

If we should fetch always and not return the cache entry if available.

Returns

IObservable<byte[]>

A observable which will signal when the data is available.

Insert(IBlobCache, string, byte[], TimeSpan)

Inserts a item into the cache.

public static IObservable<Unit> Insert(this IBlobCache blobCache, string key, byte[] data, TimeSpan expiration)

Parameters

blobCache IBlobCache

The blob cache to insert the item into.

key string

The key to associate with the entry.

data byte[]

The data for the entry.

expiration TimeSpan

A timespan that will be added to the current DateTime.

Returns

IObservable<Unit>

A observable which will signal when the item is added.

InsertObject<T>(IBlobCache, string, T, TimeSpan)

Inserts a item into the cache.

public static IObservable<Unit> InsertObject<T>(this IBlobCache blobCache, string key, T value, TimeSpan expiration)

Parameters

blobCache IBlobCache

The blob cache to insert the item into.

key string

The key to associate with the entry.

value T

The data for the entry.

expiration TimeSpan

A timespan that will be added to the current DateTime.

Returns

IObservable<Unit>

A observable which will signal when the item is added.

Type Parameters

T

The type of item to insert.

SaveLogin(ISecureBlobCache, string, string, string, TimeSpan)

Saves a username and password.

public static IObservable<Unit> SaveLogin(this ISecureBlobCache blobCache, string user, string password, string host, TimeSpan expiration)

Parameters

blobCache ISecureBlobCache

The blob cache to insert the item into.

user string

The username to store.

password string

The password to store.

host string

The host to store against.

expiration TimeSpan

A timespan that will be added to the current DateTime.

Returns

IObservable<Unit>

A observable which will signal when the item is added.