Language

CacheView Class

Definition

A component that caches the rendered HTML of its child content during server-side rendering (SSR). On cache hit, child components are not instantiated or rendered.

public sealed class CacheView : IDisposable, Microsoft.AspNetCore.Components.IComponent
type CacheView = class
    interface IComponent
    interface IDisposable
Public NotInheritable Class CacheView
Implements IComponent, IDisposable
Inheritance
CacheView
Implements

Constructors

Name Description
CacheView()

Properties

Name Description
CacheKey

Gets or sets an explicit cache key for disambiguation when multiple CacheView instances share the same component ancestor.

ChildContent

Gets or sets the content to be cached.

Enabled

Gets or sets whether caching is enabled. Defaults to true.

ExpiresAfter

Gets or sets how long after creation the cache entry should be evicted.

ExpiresOn

Gets or sets the absolute DateTimeOffset when the cache entry should be evicted.

ExpiresSliding

Gets or sets how long after last access the cache entry should be evicted. Not supported when the cache view store uses HybridCache.

VaryBy

Gets or sets a custom string value to vary the cache by.

VaryByCookie

Gets or sets a comma-separated list of cookie names to vary the cache by.

VaryByCulture

Gets or sets whether to vary the cache by the current culture.

VaryByHeader

Gets or sets a comma-separated list of HTTP header names to vary the cache by.

VaryByQuery

Gets or sets a comma-separated list of query string parameter names to vary the cache by. Use "*" to vary by all query string parameters.

VaryByRoute

Gets or sets a comma-separated list of route parameter names to vary the cache by.

VaryByUser

Gets or sets whether to vary the cache by the authenticated user identity.

Methods

Name Description
Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Explicit Interface Implementations

Name Description
IComponent.Attach(RenderHandle)

Attaches the component to a RenderHandle.

IComponent.SetParametersAsync(ParameterView)

Sets parameters supplied by the component's parent in the render tree.

Applies to