This repository was archived by the owner on Dec 14, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Tag Helpers: Create a 'cache' Tag Helper #1552
Comments
We need to review the design for this prior to commencing coding with @loudej @davidfowl |
We are going to coordinate the design for this with #1544. The main questions we have at the moment are
|
This was referenced Nov 22, 2014
pranavkm
added a commit
that referenced
this issue
Jan 7, 2015
pranavkm
added a commit
that referenced
this issue
Jan 7, 2015
pranavkm
added a commit
that referenced
this issue
Jan 7, 2015
pranavkm
added a commit
that referenced
this issue
Jan 13, 2015
Follow up issue to support Flush inside the tag helper - #1819 |
Rick-Anderson
pushed a commit
to dotnet/AspNetCore.Docs
that referenced
this issue
Jul 8, 2017
* Put in more reasonable cache times for examples. * Added to ImageTagHelper.md a block on the top and guessed at updating assetid by incrementing 1. Renamed all Additional Resources to Resources per @Devguard, fixed incorrect expires-sliding code example, removed warning about Cache NeverRemove. * fixed blank lines below toc entry, made consistent "Additional resources", put back in warning about NeverRemove based on feedback from team: #2698 (comment) * clean up * created Distributed and Environment Tag Helper Doc Pages and worked on environment. * Reworked sections from @Rick-Anderson previous commit and removed review comments. * Updated Anchor Tag Helper's definition of asp-action and asp-controller to be more explicit about defaults as well as say "href" instead of "final URL". * I realized that asp-all-route-data also behaves like asp-route-* with routing parameters so I updated the doc to reflect that. * Updated var-by-route definition following comments from Damien in old github post aspnet/Mvc#1552 * Cleanup of Tag Helper Docs * changed author to pkellner from Peter Kellner per @mairaw * Update AnchorTagHelper.md * Update CacheTagHelper.md * Minor tweaks
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
A new Tag Helper that utilizes the conditional content mode (aspnet/Razor#221) to cache the output of its contents via
ICache
. Supports varied results via attributes. In the case of a cache hit, the contents would not even be executed.Usage
Arguments
string
string
string
string
string
bool
DateTime
TimeSpan
TimeSpan
CachePreservationPriority
Cache Entry Key Generation
The cache entry key will be generated by combining a number of elements, each separated by a hyphen
-
:TagHelperContext.UniqueId
prefix([sourceKey1]=[sourceValue2],[sourceKey2]=[sourceValue3])
. Attributes not specified should be omitted from the key.Examples:
Url:
/resource?page=2
, HTML:<cache vary-by-param="page">Page @page results...</cache>
, Key:CacheTagHelper-34980348710984387343556-param(page=2)
Url:
/resource?page=2&category=45
, HTML:<cache vary-by-param="page,category">Page @page results...</cache>
, Key:CacheTagHelper-34980348710984387343556-param(page=2,category=45)
Header:
My-Header=Hello
, HTML:<cache vary-by-header="My-Header">Some content</cache>
, Key:CacheTagHelper-34980348710984387343556-header(My-Header=Hello)
Url:
/resource?page=2&category=45
, Header:My-Header=Hello
, HTML:<cache vary-by-param="page,category" vary-by-header="My-Header">Some content</cache>
, Key:CacheTagHelper-34980348710984387343556-param(page=2,category=45)-header(My-Header=Hello)
Example
The text was updated successfully, but these errors were encountered: