Class CacheableOptions
- Namespace
- Cuemon.AspNetCore.Http.Headers
- Assembly
- Cuemon.AspNetCore.dll
Configuration options for CacheableMiddleware.
public class CacheableOptions : IValidatableParameterObject, IParameterObject
- Inheritance
-
CacheableOptions
- Implements
Constructors
CacheableOptions()
Initializes a new instance of the CacheableOptions class.
public CacheableOptions()
Remarks
The following table shows the initial property values for an instance of <xref href="Cuemon.AspNetCore.Http.Headers.CacheableOptions" data-throw-if-not-resolved="false"></xref>.
<table><thead><tr><th class="term">Property</th><th class="description">Initial Value</th></tr></thead><tbody><tr><td class="term"><xref href="Cuemon.AspNetCore.Http.Headers.CacheableOptions.CacheControl" data-throw-if-not-resolved="false"></xref></td><td class="description"><pre><code class="lang-csharp">new CacheControlHeaderValue()
{ Public = true, MustRevalidate = true, NoTransform = true, MaxAge = TimeSpan.FromDays(7) };
new ExpiresHeaderValue(TimeSpan.FromDays(7));Properties
CacheControl
Gets or sets the Cache-Control header associated with a HTTP response.
public CacheControlHeaderValue CacheControl { get; set; }
Property Value
- CacheControlHeaderValue
The Cache-Control header associated with a HTTP response.
Expires
Gets or sets the Expires header associated with a HTTP response.
public ExpiresHeaderValue Expires { get; set; }
Property Value
- ExpiresHeaderValue
The Expires header associated with a HTTP response.
UseCacheControl
Gets a value indicating whether this instance has an assigned CacheControl value.
public bool UseCacheControl { get; }
Property Value
- bool
trueif this instance has a CacheControl assigned; otherwise,false.
UseExpires
Gets a value indicating whether this instance has an assigned Expires value.
public bool UseExpires { get; }
Property Value
Validators
Gets the validators that will be invoked one by one in InvokeAsync(HttpContext).
public IList<ICacheableValidator> Validators { get; set; }
Property Value
- IList<ICacheableValidator>
The validators that will be invoked by CacheableMiddleware.
Methods
ValidateOptions()
Determines whether the public read-write properties of this instance are in a valid state.
public void ValidateOptions()
Remarks
This method is expected to throw exceptions when one or more conditions fails to be in a valid state.
Exceptions
- InvalidOperationException
Validators cannot be null.