Skip to content

Instantly share code, notes, and snippets.

Created October 8, 2021 12:46
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 expires-after="TimeSpan.FromSeconds(10)">
<p>@DateTime.Now - Every 10 seconds</p>
<cache vary-by="@Model.UpdateDate.ToString()">
<p>@DateTime.Now - When Model.UpdateDate changes</p>
<cache expires-after="TimeSpan.FromSeconds(20)">
<partial name="ContactForm" model="new ContactFormViewModel()"/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment