Skip to content

Instantly share code, notes, and snippets.

@warrenbuckley
Created Oct 8, 2021
Embed
What would you like to do?
<h1>Cached Partials</h1>
<p>@DateTime.Now - No Cache</p>
<cache expires-on="new DateTime(2025,1,29,17,02,0)">
<p>@DateTime.Now - Set Date</p>
</cache>
<cache expires-after="TimeSpan.FromSeconds(10)">
<p>@DateTime.Now - Every 10 seconds</p>
</cache>
<cache vary-by="@Model.UpdateDate.ToString()">
<p>@DateTime.Now - When Model.UpdateDate changes</p>
</cache>
<cache expires-after="TimeSpan.FromSeconds(20)">
<partial name="ContactForm" model="new ContactFormViewModel()"/>
</cache>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment