2013-02-05 06:31:13 -01:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
|
|
using Umbraco.Core.Models;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Web.PublishedCache
|
|
|
|
|
|
{
|
2013-04-10 14:02:16 -02:00
|
|
|
|
public interface IPublishedContentCache : IPublishedCache
|
2013-02-05 06:31:13 -01:00
|
|
|
|
{
|
2013-03-20 16:01:49 -01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets content identified by a route.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="umbracoContext">The context.</param>
|
2013-03-31 18:47:25 -02:00
|
|
|
|
/// <param name="preview">A value indicating whether to consider unpublished content.</param>
|
2013-03-20 16:01:49 -01:00
|
|
|
|
/// <param name="route">The route</param>
|
|
|
|
|
|
/// <param name="hideTopLevelNode">A value forcing the HideTopLevelNode setting.</param>
|
|
|
|
|
|
/// <returns>The content, or null.</returns>
|
|
|
|
|
|
/// <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>If <param name="hideTopLevelNode" /> is <c>null</c> then the settings value is used.</para>
|
2013-03-31 18:47:25 -02:00
|
|
|
|
/// <para>The value of <paramref name="preview"/> overrides the context.</para>
|
2013-03-20 16:01:49 -01:00
|
|
|
|
/// </remarks>
|
2013-03-31 18:47:25 -02:00
|
|
|
|
IPublishedContent GetByRoute(UmbracoContext umbracoContext, bool preview, string route, bool? hideTopLevelNode = null);
|
2013-02-05 06:31:13 -01:00
|
|
|
|
|
2013-03-19 17:51:55 -01:00
|
|
|
|
/// <summary>
|
2013-03-20 16:01:49 -01:00
|
|
|
|
/// Gets the route for a content identified by its unique identifier.
|
2013-03-19 17:51:55 -01:00
|
|
|
|
/// </summary>
|
2013-03-20 16:01:49 -01:00
|
|
|
|
/// <param name="umbracoContext">The context.</param>
|
2013-03-31 18:47:25 -02:00
|
|
|
|
/// <param name="preview">A value indicating whether to consider unpublished content.</param>
|
2013-03-20 16:01:49 -01:00
|
|
|
|
/// <param name="contentId">The content unique identifier.</param>
|
|
|
|
|
|
/// <returns>The route.</returns>
|
2013-03-31 18:47:25 -02:00
|
|
|
|
/// <remarks>The value of <paramref name="preview"/> overrides the context.</remarks>
|
|
|
|
|
|
string GetRouteById(UmbracoContext umbracoContext, bool preview, int contentId);
|
2014-03-03 13:29:33 +01:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Creates a content fragment.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="contentTypeAlias">The content type alias.</param>
|
|
|
|
|
|
/// <param name="dataValues">The content property raw values.</param>
|
|
|
|
|
|
/// <param name="isPreviewing">A value indicating whether the fragment is previewing.</param>
|
|
|
|
|
|
/// <param name="managed">A value indicating whether the fragment is managed by the cache.</param>
|
|
|
|
|
|
/// <returns>The newly created content fragment.</returns>
|
|
|
|
|
|
//
|
|
|
|
|
|
// notes
|
|
|
|
|
|
//
|
|
|
|
|
|
// in XmlPublishedCache, IPublishedContent instances are not meant to survive longer
|
|
|
|
|
|
// that a request or else we cannot guarantee that the converted property values will
|
|
|
|
|
|
// be properly managed - because XmlPublishedProperty just stores the result of the
|
|
|
|
|
|
// conversion locally.
|
|
|
|
|
|
//
|
|
|
|
|
|
// in DrippingPublishedCache, IPublishedContent instances are meant to survive for as
|
|
|
|
|
|
// long as the content itself has not been modified, and the property respects the
|
|
|
|
|
|
// converter's indication ie whether the converted value should be cached at
|
|
|
|
|
|
// .Content - cache until the content changes
|
|
|
|
|
|
// .ContentCache - cache until any content changes
|
|
|
|
|
|
// .Request - cache for the current request
|
|
|
|
|
|
//
|
|
|
|
|
|
// a fragment can be either "detached" or "managed".
|
|
|
|
|
|
// detached: created from code, managed by code, converted property values are
|
|
|
|
|
|
// cached within the fragment itself for as long as the fragment lives
|
|
|
|
|
|
// managed: created from a property converter as part of a content, managed by
|
|
|
|
|
|
// the cache, converted property values can be cached...
|
|
|
|
|
|
//
|
|
|
|
|
|
// XmlPublishedCache: same as content properties, store the result of the
|
|
|
|
|
|
// conversion locally, neither content nor fragments should survive longer
|
|
|
|
|
|
// than a request
|
|
|
|
|
|
// DrippingPublishedCache: depends
|
|
|
|
|
|
// .Content: cache within the fragment
|
|
|
|
|
|
// .ContentCache, .Request: cache within the cache
|
|
|
|
|
|
//
|
|
|
|
|
|
// in the latter case, use a fragment-owned guid as the cache key. because we
|
|
|
|
|
|
// don't really have any other choice. this opens potential memory leaks: if the
|
|
|
|
|
|
// fragment is re-created on each request and has a property that caches its
|
|
|
|
|
|
// converted value at .ContentCache level then we'll flood that cache with data
|
|
|
|
|
|
// that's never removed (as long as no content is edited).
|
|
|
|
|
|
//
|
|
|
|
|
|
// so a requirement should be that any converter that creates fragment, should
|
|
|
|
|
|
// be marked .Content -- and nothing else
|
|
|
|
|
|
//
|
|
|
|
|
|
IPublishedContent CreateFragment(string contentTypeAlias, IDictionary<string, object> dataValues,
|
|
|
|
|
|
bool isPreviewing, bool managed);
|
2013-02-05 06:31:13 -01:00
|
|
|
|
}
|
|
|
|
|
|
}
|