2021-02-18 11:06:02 +01:00
|
|
|
using Umbraco.Cms.Core.Models.PublishedContent;
|
2018-06-29 19:52:40 +02:00
|
|
|
|
2022-06-07 15:28:38 +02:00
|
|
|
namespace Umbraco.Cms.Core.PublishedCache;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Provides access to cached contents.
|
|
|
|
|
/// </summary>
|
2024-04-09 09:06:48 +02:00
|
|
|
public interface IPublishedCache
|
2018-06-29 19:52:40 +02:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
2022-06-07 15:28:38 +02:00
|
|
|
/// Gets 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 content, or null.</returns>
|
|
|
|
|
/// <remarks>The value of <paramref name="preview" /> overrides defaults.</remarks>
|
|
|
|
|
IPublishedContent? GetById(bool preview, int contentId);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets 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 content, or null.</returns>
|
|
|
|
|
/// <remarks>The value of <paramref name="preview" /> overrides defaults.</remarks>
|
|
|
|
|
IPublishedContent? GetById(bool preview, Guid contentId);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets a content identified by its Udi identifier.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="preview">A value indicating whether to consider unpublished content.</param>
|
|
|
|
|
/// <param name="contentId">The content Udi identifier.</param>
|
|
|
|
|
/// <returns>The content, or null.</returns>
|
|
|
|
|
/// <remarks>The value of <paramref name="preview" /> overrides defaults.</remarks>
|
2024-09-10 00:49:18 +09:00
|
|
|
[Obsolete] // FIXME: Remove when replacing nucache
|
2022-06-07 15:28:38 +02:00
|
|
|
IPublishedContent? GetById(bool preview, Udi contentId);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets a content identified by its unique identifier.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="contentId">The content unique identifier.</param>
|
|
|
|
|
/// <returns>The content, or null.</returns>
|
|
|
|
|
/// <remarks>Considers published or unpublished content depending on defaults.</remarks>
|
|
|
|
|
IPublishedContent? GetById(int contentId);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets a content identified by its unique identifier.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="contentId">The content unique identifier.</param>
|
|
|
|
|
/// <returns>The content, or null.</returns>
|
|
|
|
|
/// <remarks>Considers published or unpublished content depending on defaults.</remarks>
|
|
|
|
|
IPublishedContent? GetById(Guid contentId);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets a content identified by its unique identifier.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="contentId">The content unique identifier.</param>
|
|
|
|
|
/// <returns>The content, or null.</returns>
|
|
|
|
|
/// <remarks>Considers published or unpublished content depending on defaults.</remarks>
|
2024-09-10 00:49:18 +09:00
|
|
|
[Obsolete] // FIXME: Remove when replacing nucache
|
2022-06-07 15:28:38 +02:00
|
|
|
IPublishedContent? GetById(Udi contentId);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets contents at root.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="preview">A value indicating whether to consider unpublished content.</param>
|
|
|
|
|
/// <param name="culture">A culture.</param>
|
|
|
|
|
/// <returns>The contents.</returns>
|
|
|
|
|
/// <remarks>The value of <paramref name="preview" /> overrides defaults.</remarks>
|
2024-10-01 15:03:02 +02:00
|
|
|
[Obsolete("Scheduled for removal, use IDocumentNavigationQueryService instead in v17")]
|
2022-06-07 15:28:38 +02:00
|
|
|
IEnumerable<IPublishedContent> GetAtRoot(bool preview, string? culture = null);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets contents at root.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="culture">A culture.</param>
|
|
|
|
|
/// <returns>The contents.</returns>
|
|
|
|
|
/// <remarks>Considers published or unpublished content depending on defaults.</remarks>
|
2024-10-01 15:03:02 +02:00
|
|
|
[Obsolete("Scheduled for removal, use IDocumentNavigationQueryService instead in v17")]
|
2022-06-07 15:28:38 +02:00
|
|
|
IEnumerable<IPublishedContent> GetAtRoot(string? culture = null);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets a value indicating whether the cache contains published content.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="preview">A value indicating whether to consider unpublished content.</param>
|
|
|
|
|
/// <returns>A value indicating whether the cache contains published content.</returns>
|
|
|
|
|
/// <remarks>The value of <paramref name="preview" /> overrides defaults.</remarks>
|
2024-10-01 15:03:02 +02:00
|
|
|
[Obsolete("Scheduled for removal in v17")]
|
2022-06-07 15:28:38 +02:00
|
|
|
bool HasContent(bool preview);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets a value indicating whether the cache contains published content.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>A value indicating whether the cache contains published content.</returns>
|
|
|
|
|
/// <remarks>Considers published or unpublished content depending on defaults.</remarks>
|
2024-10-01 15:03:02 +02:00
|
|
|
[Obsolete("Scheduled for removal in v17")]
|
2022-06-07 15:28:38 +02:00
|
|
|
bool HasContent();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets a content type identified by its unique identifier.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="id">The content type unique identifier.</param>
|
|
|
|
|
/// <returns>The content type, or null.</returns>
|
2024-09-10 00:49:18 +09:00
|
|
|
[Obsolete("Please use the IContentTypeCacheService instead, scheduled for removal in V16")]
|
2022-06-07 15:28:38 +02:00
|
|
|
IPublishedContentType? GetContentType(int id);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets a content type identified by its alias.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="alias">The content type alias.</param>
|
|
|
|
|
/// <returns>The content type, or null.</returns>
|
|
|
|
|
/// <remarks>The alias is case-insensitive.</remarks>
|
2024-09-10 00:49:18 +09:00
|
|
|
[Obsolete("Please use the IContentTypeCacheService instead, scheduled for removal in V16")]
|
2022-06-07 15:28:38 +02:00
|
|
|
IPublishedContentType? GetContentType(string alias);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets contents of a given content type.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="contentType">The content type.</param>
|
|
|
|
|
/// <returns>The contents.</returns>
|
2024-10-01 15:03:02 +02:00
|
|
|
[Obsolete]
|
2022-06-07 15:28:38 +02:00
|
|
|
IEnumerable<IPublishedContent> GetByContentType(IPublishedContentType contentType);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets a content type identified by its alias.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="key">The content type key.</param>
|
|
|
|
|
/// <returns>The content type, or null.</returns>
|
2024-09-10 00:49:18 +09:00
|
|
|
[Obsolete("Please use the IContentTypeCacheService instead, scheduled for removal in V16")]
|
2022-06-07 15:28:38 +02:00
|
|
|
IPublishedContentType? GetContentType(Guid key);
|
2018-06-29 19:52:40 +02:00
|
|
|
}
|