Class OutputCacheHandler
Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Handles output cache settings. Used from PageBase in WebForms and ContentOutputCacheAttribute in MVC.
Inheritance
Inherited Members
Namespace: EPiServer.Web.Internal
Assembly: EPiServer.dll
Version: 10.10.4Syntax
public class OutputCacheHandler
Constructors
OutputCacheHandler(IContentCacheRemover, IContentCacheVersion)
Declaration
public OutputCacheHandler(IContentCacheRemover contentCacheRemover, IContentCacheVersion contentCacheVersion)
Parameters
Type | Name | Description |
---|---|---|
IContentCacheRemover | contentCacheRemover | |
IContentCacheVersion | contentCacheVersion |
Methods
SetCachePolicy(IPrincipal, ContentReference, HttpContextBase, Settings, Nullable<DateTime>)
Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Sets the cache policy for this request based on parameters as current user and parameters.
Declaration
public virtual void SetCachePolicy(IPrincipal currentPrincipal, ContentReference currentContent, HttpContextBase httpContext, Settings configurationSettings, DateTime? contentExpiration)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Principal.IPrincipal | currentPrincipal | |
ContentReference | currentContent | |
System.Web.HttpContextBase | httpContext | |
Settings | configurationSettings | |
System.Nullable<System.DateTime> | contentExpiration |
Remarks
Override this method if you wish to customize the cache policy for a page. The output cache is turned on based on the following criteria:
1. The EPnCachePolicyTimeout in web.config is > 0.
2. The current user must not be logged on, aka Anonymous.
3. The request must be a GET type request. Hence, Postbacks and form postings will not be cached.
4. The current page must be the published version (the WorkID is == 0).
The cache parameters are fetched from web.config, more specifically the EPsCacheVaryByCustom and EPsCacheVaryByParams settings. Additionally, a dependency to the DataFactoryCache is set. When pages are changed, the cache is flushed. Cache item expiration is set to the HttpCacheExpiration setting, which is the number of seconds the item should reside in the cache, as long as the StopPublish value of the page is not less than the policy timeout (in which case, the StopPublish value is used).UseOutputCache(IPrincipal, HttpContextBase, TimeSpan)
Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Decides if the output cache should be used.
Declaration
public static bool UseOutputCache(IPrincipal principal, HttpContextBase context, TimeSpan duration)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Principal.IPrincipal | principal | The current principal. |
System.Web.HttpContextBase | context | The current context. |
System.TimeSpan | duration | The duration. |
Returns
Type | Description |
---|---|
System.Boolean |
ValidateOutputCache(HttpContext, Object, ref HttpValidationStatus)
Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Validates the output cache.
Declaration
public static void ValidateOutputCache(HttpContext context, object data, ref HttpValidationStatus validationStatus)
Parameters
Type | Name | Description |
---|---|---|
System.Web.HttpContext | context | The context. |
System.Object | data | The data. |
System.Web.HttpValidationStatus | validationStatus | The validation status. |