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
IBlobCacheThe blob cache to insert the item into.
url
stringThe URL to download if not already in the cache.
expiration
TimeSpanA timespan that will be added to the current DateTime.
headers
Dictionary<string, string>The headers to specify when getting the entry.
fetchAlways
boolIf 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
IBlobCacheThe blob cache to insert the item into.
url
UriThe URL to download if not already in the cache.
expiration
TimeSpanA timespan that will be added to the current DateTime.
headers
Dictionary<string, string>The headers to specify when getting the entry.
fetchAlways
boolIf 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
IBlobCacheThe blob cache to insert the item into.
key
stringThe key to associate with the entry.
data
byte[]The data for the entry.
expiration
TimeSpanA 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
IBlobCacheThe blob cache to insert the item into.
key
stringThe key to associate with the entry.
value
TThe data for the entry.
expiration
TimeSpanA 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
ISecureBlobCacheThe blob cache to insert the item into.
user
stringThe username to store.
password
stringThe password to store.
host
stringThe host to store against.
expiration
TimeSpanA timespan that will be added to the current DateTime.
Returns
- IObservable<Unit>
A observable which will signal when the item is added.