HttpCacheableFilter Class
Definition
- Namespace
- Cuemon.AspNetCore.Mvc.Filters.Cacheable
- Assemblies
- Cuemon.AspNetCore.Mvc.dll
A filter that will invoke filters implementing the ICacheableObjectResult interface.
public class HttpCacheableFilter : ConfigurableAsyncResultFilter<HttpCacheableOptions>, IConfigurable<HttpCacheableOptions>, IAsyncResultFilter, IFilterMetadata
- Inheritance
-
objectHttpCacheableFilter
- Implements
- Inherited Members
Examples
The following example shows how to compose from packet-local options and cache validators.
using System;
using Cuemon.AspNetCore.Mvc.Filters.Cacheable;
using Microsoft.Extensions.Options;
namespace MyApp.Examples;
public static class HttpCacheableFilterExample
{
public static void Demonstrate()
{
var options = new HttpCacheableOptions();
options.Filters.Add(new HttpEntityTagHeaderFilter(io => io.UseEntityTagResponseParser = true));
options.Filters.Add(new HttpLastModifiedHeaderFilter());
var filter = new HttpCacheableFilter(Options.Create(options));
Console.WriteLine(filter.Options.Filters.Count);
Console.WriteLine(filter.Options.UseCacheControl);
}
}
Constructors
| Name | Description |
|---|---|
| HttpCacheableFilter(IOptions<HttpCacheableOptions>) | Initializes a new instance of the HttpCacheableFilter class. |
Methods
| Name | Description |
|---|---|
| OnResultExecutionAsync(ResultExecutingContext, ResultExecutionDelegate) | Called asynchronously before the action result. |
See Also
ConfigurableAsyncResultFilter<TOptions>