Class PublishedCacheBase
Provides a base implementation for published content caches.
Inheritance
Namespace: Umbraco.Cms.Core.PublishedCache
Assembly: Umbraco.Core.dll
Syntax
public abstract class PublishedCacheBase : IPublishedCache
Constructors
View SourcePublishedCacheBase(IVariationContextAccessor, bool)
Initializes a new instance of the PublishedCacheBase class.
Declaration
public PublishedCacheBase(IVariationContextAccessor variationContextAccessor, bool previewDefault)
Parameters
| Type | Name | Description |
|---|---|---|
| IVariationContextAccessor | variationContextAccessor | The variation context accessor for culture and segment information. |
| bool | previewDefault | A value indicating whether preview mode is enabled by default. |
Properties
View SourcePreviewDefault
Gets a value indicating whether preview mode is enabled by default.
Declaration
public bool PreviewDefault { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
View SourceGetAtRoot(bool, string?)
Gets content items at the root of the content tree.
Declaration
public abstract IEnumerable<IPublishedContent> GetAtRoot(bool preview, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | preview | A value indicating whether to consider unpublished content. |
| string | culture | The optional culture to filter by. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | A collection of published content items at the root level. |
GetById(bool, Guid)
Gets a content identified by its unique identifier.
Declaration
public abstract IPublishedContent? GetById(bool preview, Guid contentId)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | preview | A value indicating whether to consider unpublished content. |
| Guid | contentId | The content unique identifier. |
Returns
| Type | Description |
|---|---|
| IPublishedContent | The content, or null. |
Remarks
The value of preview overrides defaults.
GetById(bool, int)
Gets a content identified by its unique identifier.
Declaration
public abstract IPublishedContent? GetById(bool preview, int contentId)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | preview | A value indicating whether to consider unpublished content. |
| int | contentId | The content unique identifier. |
Returns
| Type | Description |
|---|---|
| IPublishedContent | The content, or null. |
Remarks
The value of preview overrides defaults.
GetById(Guid)
Gets a content identified by its unique identifier.
Declaration
public IPublishedContent? GetById(Guid contentId)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | contentId | The content unique identifier. |
Returns
| Type | Description |
|---|---|
| IPublishedContent | The content, or null. |
Remarks
Considers published or unpublished content depending on defaults.
GetById(int)
Gets a content identified by its unique identifier.
Declaration
public IPublishedContent? GetById(int contentId)
Parameters
| Type | Name | Description |
|---|---|---|
| int | contentId | The content unique identifier. |
Returns
| Type | Description |
|---|---|
| IPublishedContent | The content, or null. |
Remarks
Considers published or unpublished content depending on defaults.
HasById(bool, int)
Determines whether content with the specified identifier exists.
Declaration
public abstract bool HasById(bool preview, int contentId)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | preview | A value indicating whether to consider unpublished content. |
| int | contentId | The content unique identifier. |
Returns
| Type | Description |
|---|---|
| bool |
|
HasById(int)
Determines whether content with the specified identifier exists using the default preview setting.
Declaration
public bool HasById(int contentId)
Parameters
| Type | Name | Description |
|---|---|---|
| int | contentId | The content unique identifier. |
Returns
| Type | Description |
|---|---|
| bool |
|