Web.PublishedCache - refactor how caches manage preview
This commit is contained in:
@@ -26,10 +26,26 @@ namespace Umbraco.Web.PublishedCache
|
||||
/// <param name="route">The route</param>
|
||||
/// <param name="hideTopLevelNode">A value forcing the HideTopLevelNode setting.</param>
|
||||
/// <returns>The content, or null.</returns>
|
||||
/// <remarks>A valid route is either a simple path eg <c>/foo/bar/nil</c> or a root node id and a path, eg <c>123/foo/bar/nil</c>.</remarks>
|
||||
/// <remarks>
|
||||
/// <para>A valid route is either a simple path eg <c>/foo/bar/nil</c> or a root node id and a path, eg <c>123/foo/bar/nil</c>.</para>
|
||||
/// <para>Considers published or unpublished content depending on context.</para>
|
||||
/// </remarks>
|
||||
public IPublishedContent GetByRoute(string route, bool? hideTopLevelNode = null)
|
||||
{
|
||||
return InnerCache.GetByRoute(UmbracoContext, route, hideTopLevelNode);
|
||||
return GetByRoute(UmbracoContext.InPreviewMode, route, hideTopLevelNode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets content identified by a route.
|
||||
/// </summary>
|
||||
/// <param name="preview">A value indicating whether to consider unpublished content.</param>
|
||||
/// <param name="route">The route</param>
|
||||
/// <param name="hideTopLevelNode">A value forcing the HideTopLevelNode setting.</param>
|
||||
/// <returns>The content, or null.</returns>
|
||||
/// <remarks>A valid route is either a simple path eg <c>/foo/bar/nil</c> or a root node id and a path, eg <c>123/foo/bar/nil</c>.</remarks>
|
||||
public IPublishedContent GetByRoute(bool preview, string route, bool? hideTopLevelNode = null)
|
||||
{
|
||||
return InnerCache.GetByRoute(UmbracoContext, preview, route, hideTopLevelNode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -37,9 +53,22 @@ namespace Umbraco.Web.PublishedCache
|
||||
/// </summary>
|
||||
/// <param name="contentId">The content unique identifier.</param>
|
||||
/// <returns>The route.</returns>
|
||||
/// <remarks>Considers published or unpublished content depending on context.</remarks>
|
||||
public string GetRouteById(int contentId)
|
||||
{
|
||||
return InnerCache.GetRouteById(UmbracoContext, contentId);
|
||||
return GetRouteById(UmbracoContext.InPreviewMode, contentId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the route for a content identified by its unique identifier.
|
||||
/// </summary>
|
||||
/// <param name="preview">A value indicating whether to consider unpublished content.</param>
|
||||
/// <param name="contentId">The content unique identifier.</param>
|
||||
/// <returns>The route.</returns>
|
||||
/// <remarks>Considers published or unpublished content depending on context.</remarks>
|
||||
public string GetRouteById(bool preview, int contentId)
|
||||
{
|
||||
return InnerCache.GetRouteById(UmbracoContext, preview, contentId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user