Web.PublishedCache - refactor how caches manage preview

This commit is contained in:
Stephan
2013-03-31 18:47:25 -02:00
parent efee4d0c0c
commit c5b6bb52e0
12 changed files with 213 additions and 102 deletions

View File

@@ -20,49 +20,62 @@ namespace Umbraco.Web.PublishedCache
/// Gets a content identified by its unique identifier.
/// </summary>
/// <param name="umbracoContext">The context.</param>
/// <param name="preview">A value indicating whether to consider unpublished content.</param>
/// <param name="contentId">The content unique identifier.</param>
/// <returns>The content, or null.</returns>
IPublishedContent GetById(UmbracoContext umbracoContext, int contentId);
/// <remarks>The value of <paramref name="preview"/> overrides the context.</remarks>
IPublishedContent GetById(UmbracoContext umbracoContext, bool preview, int contentId);
/// <summary>
/// Gets contents at root.
/// </summary>
/// <param name="umbracoContext">The context.</param>
/// <param name="preview">A value indicating whether to consider unpublished content.</param>
/// <returns>The contents.</returns>
IEnumerable<IPublishedContent> GetAtRoot(UmbracoContext umbracoContext);
/// <remarks>The value of <paramref name="preview"/> overrides the context.</remarks>
IEnumerable<IPublishedContent> GetAtRoot(UmbracoContext umbracoContext, bool preview);
/// <summary>
/// Gets a content resulting from an XPath query.
/// </summary>
/// <param name="umbracoContext">The context.</param>
/// <param name="preview">A value indicating whether to consider unpublished content.</param>
/// <param name="xpath">The XPath query.</param>
/// <param name="vars">Optional XPath variables.</param>
/// <returns>The content, or null.</returns>
IPublishedContent GetSingleByXPath(UmbracoContext umbracoContext, string xpath, XPathVariable[] vars);
/// <remarks>The value of <paramref name="preview"/> overrides the context.</remarks>
IPublishedContent GetSingleByXPath(UmbracoContext umbracoContext, bool preview, string xpath, XPathVariable[] vars);
/// <summary>
/// Gets contents resulting from an XPath query.
/// </summary>
/// <param name="umbracoContext">The context.</param>
/// <param name="preview">A value indicating whether to consider unpublished content.</param>
/// <param name="xpath">The XPath query.</param>
/// <param name="vars">Optional XPath variables.</param>
/// <returns>The contents.</returns>
IEnumerable<IPublishedContent> GetByXPath(UmbracoContext umbracoContext, string xpath, XPathVariable[] vars);
/// <remarks>The value of <paramref name="preview"/> overrides the context.</remarks>
IEnumerable<IPublishedContent> GetByXPath(UmbracoContext umbracoContext, bool preview, string xpath, XPathVariable[] vars);
/// <summary>
/// Gets an XPath navigator that can be used to navigate contents.
/// </summary>
/// <param name="umbracoContext">The context.</param>
/// <param name="preview">A value indicating whether to consider unpublished content.</param>
/// <returns>The XPath navigator.</returns>
XPathNavigator GetXPathNavigator(UmbracoContext umbracoContext);
/// <remarks>The value of <paramref name="preview"/> overrides the context.</remarks>
XPathNavigator GetXPathNavigator(UmbracoContext umbracoContext, bool preview);
/// <summary>
/// Gets a value indicating whether the cache contains published content.
/// </summary>
/// <param name="umbracoContext">The context.</param>
/// <param name="preview">A value indicating whether to consider unpublished content.</param>
/// <returns>A value indicating whether the cache contains published content.</returns>
bool HasContent();
//TODO: SD: We should make this happen! This will allow us to natively do a GetByDocumentType query
/// <remarks>The value of <paramref name="preview"/> overrides the context.</remarks>
bool HasContent(UmbracoContext umbracoContext, bool preview);
//TODO: SD: We should make this happen! This will allow us to natively do a GetByDocumentType query
// on the UmbracoHelper (or an internal DataContext that it uses, etc...)
// One issue is that we need to make media work as fast as we can and need to create a ConvertFromMediaObject
// method in the DefaultPublishedMediaStore, there's already a TODO noting this but in order to do that we'll