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
requestHttpRequest Message The originating request.
keystringA unique key used to identify the request details, that was given in Save().
ctCancellationToken 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
requestHttpRequest Message The originating request.
responseHttpResponse Message The response whose body you should save.
keystringA unique key used to identify the request details.
ctCancellationToken Cancellation token.
Returns
- Task
Completion.