Caching
For caching HTTP responses, Wolverine can simply work with the Response Caching Middleware in ASP.NET Core.
Wolverine.HTTP will respect your usage of the [ResponseCache] attribute on either the endpoint handler or method to write out both the vary and cache-control HTTP headers —
with an attribute on the method taking precedence.
Here’s an example or two:
// This is all it takes:
[WolverineGet("/cache/one"), ResponseCache(Duration = 3, VaryByHeader = "accept-encoding", NoStore = false)]
public static string GetOne()
{
return "one";
}
[WolverineGet("/cache/two"), ResponseCache(Duration = 10, NoStore = true)]
public static string GetTwo()
{
return "two";
}snippet source | anchor
Wolverine.HTTP will also modify the OpenAPI metadata to reflect the caching as well as embed the metadata in the ASP.Net Core
Endpoint for utilization inside of the response caching middleware.