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.


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.


    <p rx-page-cache="true">
        <span>This content is cached by page.</span>

        <span>This content is not cached.<span>


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.