diff --git a/src/Umbraco.Web/HtmlHelperRenderExtensions.cs b/src/Umbraco.Web/HtmlHelperRenderExtensions.cs index 2a009dfaa2..d8af4eecf0 100644 --- a/src/Umbraco.Web/HtmlHelperRenderExtensions.cs +++ b/src/Umbraco.Web/HtmlHelperRenderExtensions.cs @@ -82,7 +82,8 @@ namespace Umbraco.Web int cachedSeconds, bool cacheByPage = false, bool cacheByMember = false, - ViewDataDictionary viewData = null) + ViewDataDictionary viewData = null, + Func contextualKeyBuilder = null) { var cacheKey = new StringBuilder(partialViewName); if (cacheByPage) @@ -97,7 +98,12 @@ namespace Umbraco.Web { var currentMember = Member.GetCurrentMember(); cacheKey.AppendFormat("m{0}-", currentMember == null ? 0 : currentMember.Id); - } + } + if (contextualKeyBuilder != null) + { + var contextualKey = contextualKeyBuilder(model, viewData); + cacheKey.Append("c{0}-", contextualKey); + } return ApplicationContext.Current.ApplicationCache.CachedPartialView(htmlHelper, partialViewName, model, cachedSeconds, cacheKey.ToString(), viewData); } @@ -813,4 +819,4 @@ namespace Umbraco.Web #endregion } -} \ No newline at end of file +}