Interface IPublishedElementCache
Provides access to cached published elements.
Namespace: Umbraco.Cms.Core.PublishedCache
Assembly: Umbraco.Core.dll
Syntax
public interface IPublishedElementCache
Methods
View SourceGetById(bool, Guid)
Synchronously gets a published element by its unique key.
Declaration
IPublishedElement? GetById(bool preview, Guid key)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | preview | A value indicating whether to consider unpublished content. |
| Guid | key | The element's unique key. |
Returns
| Type | Description |
|---|---|
| IPublishedElement | The published element, or |
Remarks
Implementations should serve the warm-cache case without setting up an async state machine. The default implementation blocks on GetByIdAsync(Guid, bool?) for backwards compatibility; consumers calling sync-over-async should prefer this overload.
GetByIdAsync(Guid, bool?)
Gets a published element by its unique key.
Declaration
Task<IPublishedElement?> GetByIdAsync(Guid key, bool? preview = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The element's unique key. |
| bool? | preview | Optional value indicating whether to include unpublished content. |
Returns
| Type | Description |
|---|---|
| Task<IPublishedElement> | The published element, or |