The page cache tag helper enables by page caching of an HTML element ("donut" caching). The cache varies by page, request culture, and route values. The cache is automatically invalidated if the page is updated.

Usage

Add the rx-page-cache attribute to any HTML element. The attribute value must be true. The tag helper does not have any other attributes.

Examples

<body>
    <p rx-page-cache="true">
        <span>This content is cached by page.</span>
        @Model.Content.CachedText
    </p>

    <p>
        <span>This content is not cached.<span>
        @Model.Content.UncachedText
    </p>
</body>

Remarks

The page cache will only be invalidated when updates to the current page are detected. Any content taken from other pages that is rendered inside the element (e.g. a list of news articles), will not trigger cache invalidation if it is updated. Therefore the page cache is only suitable for caching content that is contained only within the current page.