Rename PrimeCache to PrimeCacheAsync (keeping older name as obsolete overload). Fixes #246.

This commit is contained in:
SteveSandersonMS
2016-08-16 13:57:37 -07:00
parent c53bd8f8f6
commit 56cb898bde
2 changed files with 10 additions and 4 deletions

View File

@@ -4,8 +4,8 @@
<cache vary-by="@Context.Request.Path"> <cache vary-by="@Context.Request.Path">
<app asp-prerender-module="wwwroot/ng-app/boot-server">Loading...</app> <app asp-prerender-module="wwwroot/ng-app/boot-server">Loading...</app>
@await Html.PrimeCache(Url.Action("GenreMenuList", "GenresApi")) @await Html.PrimeCacheAsync(Url.Action("GenreMenuList", "GenresApi"))
@await Html.PrimeCache(Url.Action("MostPopular", "AlbumsApi")) @await Html.PrimeCacheAsync(Url.Action("MostPopular", "AlbumsApi"))
</cache> </cache>
@section scripts { @section scripts {

View File

@@ -11,9 +11,15 @@ namespace Microsoft.AspNetCore.AngularServices
{ {
public static class PrimeCacheHelper public static class PrimeCacheHelper
{ {
public static async Task<HtmlString> PrimeCache(this IHtmlHelper html, string url) [Obsolete("Use PrimeCacheAsync instead")]
public static Task<IHtmlContent> PrimeCache(this IHtmlHelper html, string url)
{ {
// TODO: Consider deduplicating the PrimeCache calls (that is, if there are multiple requests to precache return PrimeCacheAsync(html, url);
}
public static async Task<IHtmlContent> PrimeCacheAsync(this IHtmlHelper html, string url)
{
// TODO: Consider deduplicating the PrimeCacheAsync calls (that is, if there are multiple requests to precache
// the same URL, only return nonempty for one of them). This will make it easier to auto-prime-cache any // the same URL, only return nonempty for one of them). This will make it easier to auto-prime-cache any
// HTTP requests made during server-side rendering, without risking unnecessary duplicate requests. // HTTP requests made during server-side rendering, without risking unnecessary duplicate requests.