using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Umbraco.Core.Models;
namespace Umbraco.Web.PublishedCache
{
///
/// Provides access to cached documents in a specified context.
///
internal class ContextualPublishedContentCache : ContextualPublishedCache
{
private readonly IPublishedContentCache _cache;
///
/// Initializes a new instance of the class with a published content cache and a context.
///
/// A published content cache.
/// A context.
public ContextualPublishedContentCache(IPublishedContentCache cache, UmbracoContext umbracoContext)
: base(umbracoContext, cache)
{
_cache = cache;
}
///
/// Gets the inner IPublishedContentCache.
///
/// For unit tests.
internal IPublishedContentCache InnerCache { get { return _cache; } }
///
/// Gets content identified by a route.
///
/// The route
/// FIXME
/// The content, or null.
/// A valid route is either a simple path eg /foo/bar/nil or a root node id and a path, eg 123/foo/bar/nil.
public IPublishedContent GetByRoute(string route, bool? hideTopLevelNode = null)
{
return _cache.GetByRoute(UmbracoContext, route, hideTopLevelNode);
}
///
/// Gets the route for a content identified by its unique identifier.
///
/// The content unique identifier.
/// The route.
public string GetRouteById(int contentId)
{
return _cache.GetRouteById(UmbracoContext, contentId);
}
// FIXME do we want that one here?
public IPublishedContent GetByUrlAlias(int rootNodeId, string alias)
{
return _cache.GetByUrlAlias(UmbracoContext, rootNodeId, alias);
}
}
}