Class HttpExtensions
- Namespace
- Akavache
- Assembly
- Akavache.dll
Provides extension methods for handling HTTP operations and stream operations.
- Inheritance
-
Http
Extensions
Methods
DownloadUrl(IBlobCache, string, HttpMethod?, IEnumerable<KeyValuePair<string, string>>?, bool, DateTimeOffset?)
Downloads data from an HTTP URL and inserts the result into the cache. If the data is already in the cache, this returns a cached value. The URL itself is used as the cache key.
public static IObservable<byte[]> DownloadUrl(this IBlobCache blobCache, string url, HttpMethod? method = null, IEnumerable<KeyValuePair<string, string>>? headers = null, bool fetchAlways = false, DateTimeOffset? absoluteExpiration = null)
Parameters
blobCacheIBlobCache The blob cache to perform the operation on.
urlstringThe URL to download.
methodHttpMethod The HTTP method to use for the request.
headersIEnumerable<KeyValue <string, string>>Pair An optional collection containing HTTP request headers.
fetchAlwaysboolA value indicating whether to force a web request to always be issued, skipping the cache.
absoluteExpirationDateTime ?Offset An optional expiration date for the cached data.
Returns
- IObservable<byte[]>
An observable that emits the data downloaded from the URL.
DownloadUrl(IBlobCache, string, string, HttpMethod?, IEnumerable<KeyValuePair<string, string>>?, bool, DateTimeOffset?)
Download data from an HTTP URL and insert the result into the cache. If the data is already in the cache, this returns a cached value. An explicit key is provided rather than the URL itself.
public static IObservable<byte[]> DownloadUrl(this IBlobCache blobCache, string key, string url, HttpMethod? method = null, IEnumerable<KeyValuePair<string, string>>? headers = null, bool fetchAlways = false, DateTimeOffset? absoluteExpiration = null)
Parameters
blobCacheIBlobCache The blob cache to perform the operation on.
keystringThe key to store with.
urlstringThe URL to download.
methodHttpMethod The method.
headersIEnumerable<KeyValue <string, string>>Pair An optional Dictionary containing the HTTP request headers.
fetchAlwaysboolForce a web request to always be issued, skipping the cache.
absoluteExpirationDateTime ?Offset An optional expiration date.
Returns
- IObservable<byte[]>
The data downloaded from the URL.
DownloadUrl(IBlobCache, string, Uri, HttpMethod?, IEnumerable<KeyValuePair<string, string>>?, bool, DateTimeOffset?)
Download data from an HTTP URL and insert the result into the cache. If the data is already in the cache, this returns a cached value. An explicit key is provided rather than the URL itself.
public static IObservable<byte[]> DownloadUrl(this IBlobCache blobCache, string key, Uri url, HttpMethod? method = null, IEnumerable<KeyValuePair<string, string>>? headers = null, bool fetchAlways = false, DateTimeOffset? absoluteExpiration = null)
Parameters
blobCacheIBlobCache The blob cache to perform the operation on.
keystringThe key to store with.
urlUriThe URL to download.
methodHttpMethod The method.
headersIEnumerable<KeyValue <string, string>>Pair An optional Dictionary containing the HTTP request headers.
fetchAlwaysboolForce a web request to always be issued, skipping the cache.
absoluteExpirationDateTime ?Offset An optional expiration date.
Returns
- IObservable<byte[]>
The data downloaded from the URL.
DownloadUrl(IBlobCache, Uri, HttpMethod?, IEnumerable<KeyValuePair<string, string>>?, bool, DateTimeOffset?)
Download data from an HTTP URL and insert the result into the cache. If the data is already in the cache, this returns a cached value. The URL itself is used as the key.
public static IObservable<byte[]> DownloadUrl(this IBlobCache blobCache, Uri url, HttpMethod? method = null, IEnumerable<KeyValuePair<string, string>>? headers = null, bool fetchAlways = false, DateTimeOffset? absoluteExpiration = null)
Parameters
blobCacheIBlobCache The blob cache to perform the operation on.
urlUriThe URL to download.
methodHttpMethod The method.
headersIEnumerable<KeyValue <string, string>>Pair An optional Dictionary containing the HTTP request headers.
fetchAlwaysboolForce a web request to always be issued, skipping the cache.
absoluteExpirationDateTime ?Offset An optional expiration date.
Returns
- IObservable<byte[]>
The data downloaded from the URL.
WriteAsyncRx(Stream, byte[], int, int)
Writes data to a stream asynchronously and returns an observable.
public static IObservable<Unit> WriteAsyncRx(this Stream blobCache, byte[] data, int start, int length)
Parameters
blobCacheStreamThe stream to write to.
databyte[]The data to write to the stream.
startintThe starting index in the data array.
lengthintThe number of bytes to write.
Returns
- IObservable<Unit>
An observable that signals when the write operation has completed.