Interface IRequestCache
- Namespace
- Fusillade
- Assembly
- Fusillade.dll
This Interface is a simple cache for HTTP requests - it is intentionally not designed to conform to HTTP caching rules since you most likely want to override those rules in a client app anyways.
- Extension Methods
Methods
Fetch(HttpRequestMessage, string, CancellationToken)
Implement this by loading the Body of the given request / key.
Parameters
request
HttpRequest Message The originating request.
key
stringA unique key used to identify the request details, that was given in Save().
ct
CancellationToken Cancellation token.
Returns
- Task<byte[]>
The Body of the given request, or null if the search completed successfully but the response was not found.
Save(HttpRequestMessage, HttpResponseMessage, string, CancellationToken)
Implement this method by saving the Body of the response. The response is already downloaded as a ByteArrayContent so you don't have to worry about consuming the stream.
Task Save(HttpRequestMessage request, HttpResponseMessage response, string key, CancellationToken ct)
Parameters
request
HttpRequest Message The originating request.
response
HttpResponse Message The response whose body you should save.
key
stringA unique key used to identify the request details.
ct
CancellationToken Cancellation token.
Returns
- Task
Completion.