diff --git a/src/Umbraco.Web.Common/Extensions/CacheHelperExtensions.cs b/src/Umbraco.Web.Common/Extensions/CacheHelperExtensions.cs
index d52d1406408a..56bfcefd9a29 100644
--- a/src/Umbraco.Web.Common/Extensions/CacheHelperExtensions.cs
+++ b/src/Umbraco.Web.Common/Extensions/CacheHelperExtensions.cs
@@ -20,7 +20,7 @@ public static class CacheHelperExtensions
///
///
///
- ///
+ ///
/// used to cache the partial view, this key could change if it is cached by page or by member
///
///
@@ -30,7 +30,7 @@ public static IHtmlContent CachedPartialView(
IHtmlHelper htmlHelper,
string partialViewName,
object model,
- int cachedSeconds,
+ TimeSpan cacheTimeout,
string cacheKey,
ViewDataDictionary viewData = null)
{
@@ -41,10 +41,12 @@ public static IHtmlContent CachedPartialView(
return htmlHelper.Partial(partialViewName, model, viewData);
}
- return appCaches.RuntimeCache.GetCacheItem(
+ var result = appCaches.RuntimeCache.GetCacheItem(
CoreCacheHelperExtensions.PartialViewCacheKey + cacheKey,
- () => htmlHelper.Partial(partialViewName, model, viewData),
- timeout: new TimeSpan(0, 0, 0, cachedSeconds));
+ () => new HtmlString(htmlHelper.Partial(partialViewName, model, viewData).ToHtmlString()),
+ timeout: cacheTimeout);
+
+ return result;
}
}
diff --git a/src/Umbraco.Web.Website/Extensions/HtmlContentExtensions.cs b/src/Umbraco.Web.Common/Extensions/HtmlContentExtensions.cs
similarity index 100%
rename from src/Umbraco.Web.Website/Extensions/HtmlContentExtensions.cs
rename to src/Umbraco.Web.Common/Extensions/HtmlContentExtensions.cs
diff --git a/src/Umbraco.Web.Website/Extensions/HtmlHelperRenderExtensions.cs b/src/Umbraco.Web.Website/Extensions/HtmlHelperRenderExtensions.cs
index e728c432e1dd..967ef2b87d84 100644
--- a/src/Umbraco.Web.Website/Extensions/HtmlHelperRenderExtensions.cs
+++ b/src/Umbraco.Web.Website/Extensions/HtmlHelperRenderExtensions.cs
@@ -88,7 +88,7 @@ public static async Task CachedPartialAsync(
this IHtmlHelper htmlHelper,
string partialViewName,
object model,
- int cachedSeconds,
+ TimeSpan cacheTimeout,
bool cacheByPage = false,
bool cacheByMember = false,
ViewDataDictionary viewData = null,
@@ -129,7 +129,7 @@ public static async Task CachedPartialAsync(
var appCaches = GetRequiredService(htmlHelper);
var hostingEnvironment = GetRequiredService(htmlHelper);
- return appCaches.CachedPartialView(hostingEnvironment, htmlHelper, partialViewName, model, cachedSeconds, cacheKey.ToString(), viewData);
+ return appCaches.CachedPartialView(hostingEnvironment, htmlHelper, partialViewName, model, cacheTimeout, cacheKey.ToString(), viewData);
}
// public static IHtmlContent EditorFor(this IHtmlHelper htmlHelper, string templateName = "", string htmlFieldName = "", object additionalViewData = null)