Search Results for

    Show / Hide Table of Contents
    View Source

    Interface IPublishedElementCache

    Provides access to cached published elements.

    Namespace: Umbraco.Cms.Core.PublishedCache
    Assembly: Umbraco.Core.dll
    Syntax
    public interface IPublishedElementCache

    Methods

    View Source

    GetById(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 null if not found.

    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.

    View Source

    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 null if not found.

    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX