Page Cache Tag Helper

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

Usage

Add the re-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 re-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 within the current page.