Search Results for

    Show / Hide Table of Contents
    View Source

    Class ContentStore

    Stores content in memory and persists it back to disk

    Inheritance
    System.Object
    Namespace: Umbraco.Cms.Infrastructure.PublishedCache
    Assembly: Umbraco.PublishedCache.NuCache.dll
    Syntax
    public class ContentStore
    Remarks

    Methods in this class suffixed with the term "Locked" means that those methods can only be called within a WriteLock. A WriteLock is acquired by the GetScopedWriteLock method. Locks are not allowed to be recursive.

    This class's logic is based on the SnapDictionary<TKey, TValue> class but has been slightly modified to suit these purposes.

    Constructors

    View Source

    ContentStore(IPublishedSnapshotAccessor, IVariationContextAccessor, ILogger, ILoggerFactory, IPublishedModelFactory, Nullable<BPlusTree<Int32, ContentNodeKit>>)

    Declaration
    public ContentStore(IPublishedSnapshotAccessor publishedSnapshotAccessor, IVariationContextAccessor variationContextAccessor, ILogger logger, ILoggerFactory loggerFactory, IPublishedModelFactory publishedModelFactory, BPlusTree<int, ContentNodeKit>? localDb = null)
    Parameters
    Type Name Description
    IPublishedSnapshotAccessor publishedSnapshotAccessor
    IVariationContextAccessor variationContextAccessor
    ILogger logger
    ILoggerFactory loggerFactory
    IPublishedModelFactory publishedModelFactory
    System.Nullable<BPlusTree<System.Int32, ContentNodeKit>> localDb

    Properties

    View Source

    Count

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    System.Int32
    View Source

    GenCount

    Declaration
    public long GenCount { get; }
    Property Value
    Type Description
    System.Int64
    View Source

    LiveSnapshot

    Declaration
    public ContentStore.Snapshot LiveSnapshot { get; }
    Property Value
    Type Description
    ContentStore.Snapshot
    View Source

    SnapCount

    Declaration
    public long SnapCount { get; }
    Property Value
    Type Description
    System.Int64

    Methods

    View Source

    ClearLocked(Int32)

    Clears data for a given node id

    Declaration
    public bool ClearLocked(int id)
    Parameters
    Type Name Description
    System.Int32 id
    Returns
    Type Description
    System.Boolean
    Remarks

    This methods MUST be called from within a write lock, normally wrapped within GetScopedWriteLock otherwise an exception will occur.

    View Source

    CollectAsync()

    Declaration
    public Task CollectAsync()
    Returns
    Type Description
    Task
    View Source

    CreateSnapshot()

    Declaration
    public ContentStore.Snapshot CreateSnapshot()
    Returns
    Type Description
    ContentStore.Snapshot
    View Source

    Get(Guid, Int64)

    Declaration
    public ContentNode Get(Guid uid, long gen)
    Parameters
    Type Name Description
    Guid uid
    System.Int64 gen
    Returns
    Type Description
    ContentNode
    View Source

    Get(Int32, Int64)

    Declaration
    public ContentNode Get(int id, long gen)
    Parameters
    Type Name Description
    System.Int32 id
    System.Int64 gen
    Returns
    Type Description
    ContentNode
    View Source

    GetAll(Int64)

    Declaration
    public IEnumerable<ContentNode> GetAll(long gen)
    Parameters
    Type Name Description
    System.Int64 gen
    Returns
    Type Description
    IEnumerable<ContentNode>
    View Source

    GetAtRoot(Int64)

    Declaration
    public IEnumerable<ContentNode> GetAtRoot(long gen)
    Parameters
    Type Name Description
    System.Int64 gen
    Returns
    Type Description
    IEnumerable<ContentNode>
    View Source

    GetContentType(Guid, Int64)

    Declaration
    public IPublishedContentType GetContentType(Guid key, long gen)
    Parameters
    Type Name Description
    Guid key
    System.Int64 gen
    Returns
    Type Description
    IPublishedContentType
    View Source

    GetContentType(Int32, Int64)

    Declaration
    public IPublishedContentType GetContentType(int id, long gen)
    Parameters
    Type Name Description
    System.Int32 id
    System.Int64 gen
    Returns
    Type Description
    IPublishedContentType
    View Source

    GetContentType(String, Int64)

    Declaration
    public IPublishedContentType GetContentType(string alias, long gen)
    Parameters
    Type Name Description
    System.String alias
    System.Int64 gen
    Returns
    Type Description
    IPublishedContentType
    View Source

    GetScopedWriteLock(ICoreScopeProvider)

    Declaration
    public IDisposable? GetScopedWriteLock(ICoreScopeProvider scopeProvider)
    Parameters
    Type Name Description
    ICoreScopeProvider scopeProvider
    Returns
    Type Description
    System.Nullable<IDisposable>
    View Source

    IsEmpty(Int64)

    Declaration
    public bool IsEmpty(long gen)
    Parameters
    Type Name Description
    System.Int64 gen
    Returns
    Type Description
    System.Boolean
    View Source

    NewContentTypesLocked(IEnumerable<IPublishedContentType>)

    Sets data for new content types

    Declaration
    public void NewContentTypesLocked(IEnumerable<IPublishedContentType> types)
    Parameters
    Type Name Description
    IEnumerable<IPublishedContentType> types
    Remarks

    This methods MUST be called from within a write lock, normally wrapped within GetScopedWriteLock otherwise an exception will occur.

    View Source

    ReleaseLocalDb()

    Declaration
    public void ReleaseLocalDb()
    View Source

    SetAllContentTypesLocked(Nullable<IEnumerable<IPublishedContentType>>)

    Updates/sets data for all content types

    Declaration
    public void SetAllContentTypesLocked(IEnumerable<IPublishedContentType>? types)
    Parameters
    Type Name Description
    System.Nullable<IEnumerable<IPublishedContentType>> types
    Remarks

    This methods MUST be called from within a write lock, normally wrapped within GetScopedWriteLock otherwise an exception will occur.

    View Source

    SetAllFastSortedLocked(IEnumerable<ContentNodeKit>, Boolean)

    Builds all kits on startup using a fast forward only cursor

    Declaration
    public bool SetAllFastSortedLocked(IEnumerable<ContentNodeKit> kits, bool fromDb)
    Parameters
    Type Name Description
    IEnumerable<ContentNodeKit> kits

    All kits sorted by Level + Parent Id + Sort order

    System.Boolean fromDb

    True if the data is coming from the database (not the local cache db)

    Returns
    Type Description
    System.Boolean
    Remarks

    This requires that the collection is sorted by Level + ParentId + Sort Order. This should be used only on a site startup as the first generations. This CANNOT be used after startup since it bypasses all checks for Generations.

    This methods MUST be called from within a write lock, normally wrapped within GetScopedWriteLock otherwise an exception will occur.

    View Source

    SetAllFastSortedLocked(IEnumerable<ContentNodeKit>, Int32, Boolean)

    Builds all kits on startup using a fast forward only cursor

    Declaration
    public bool SetAllFastSortedLocked(IEnumerable<ContentNodeKit> kits, int kitGroupSize, bool fromDb)
    Parameters
    Type Name Description
    IEnumerable<ContentNodeKit> kits

    All kits sorted by Level + Parent Id + Sort order

    System.Int32 kitGroupSize
    System.Boolean fromDb

    True if the data is coming from the database (not the local cache db)

    Returns
    Type Description
    System.Boolean
    Remarks

    This requires that the collection is sorted by Level + ParentId + Sort Order. This should be used only on a site startup as the first generations. This CANNOT be used after startup since it bypasses all checks for Generations.

    This methods MUST be called from within a write lock, normally wrapped within GetScopedWriteLock otherwise an exception will occur.

    View Source

    SetAllLocked(IEnumerable<ContentNodeKit>)

    Set all data for a collection of ContentNodeKit

    Declaration
    public bool SetAllLocked(IEnumerable<ContentNodeKit> kits)
    Parameters
    Type Name Description
    IEnumerable<ContentNodeKit> kits
    Returns
    Type Description
    System.Boolean
    Remarks

    This methods MUST be called from within a write lock, normally wrapped within GetScopedWriteLock otherwise an exception will occur.

    View Source

    SetAllLocked(IEnumerable<ContentNodeKit>, Int32, Boolean)

    Set all data for a collection of ContentNodeKit

    Declaration
    public bool SetAllLocked(IEnumerable<ContentNodeKit> kits, int kitGroupSize, bool fromDb)
    Parameters
    Type Name Description
    IEnumerable<ContentNodeKit> kits
    System.Int32 kitGroupSize
    System.Boolean fromDb

    True if the data is coming from the database (not the local cache db)

    Returns
    Type Description
    System.Boolean
    Remarks

    This methods MUST be called from within a write lock, normally wrapped within GetScopedWriteLock otherwise an exception will occur.

    View Source

    SetBranchLocked(Int32, IEnumerable<ContentNodeKit>)

    Sets data for a branch of ContentNodeKit

    Declaration
    public bool SetBranchLocked(int rootContentId, IEnumerable<ContentNodeKit> kits)
    Parameters
    Type Name Description
    System.Int32 rootContentId
    IEnumerable<ContentNodeKit> kits
    Returns
    Type Description
    System.Boolean
    Remarks

    IMPORTANT kits must be sorted out by LEVEL and by SORT ORDER

    This methods MUST be called from within a write lock, normally wrapped within GetScopedWriteLock otherwise an exception will occur.

    View Source

    SetLocked(ContentNodeKit)

    Sets the data for a ContentNodeKit

    Declaration
    public bool SetLocked(ContentNodeKit kit)
    Parameters
    Type Name Description
    ContentNodeKit kit
    Returns
    Type Description
    System.Boolean
    Remarks

    This methods MUST be called from within a write lock, normally wrapped within GetScopedWriteLock otherwise an exception will occur.

    View Source

    UpdateContentTypesLocked(IEnumerable<IPublishedContentType>)

    Sets data for updated content types

    Declaration
    public void UpdateContentTypesLocked(IEnumerable<IPublishedContentType> types)
    Parameters
    Type Name Description
    IEnumerable<IPublishedContentType> types
    Remarks

    This methods MUST be called from within a write lock, normally wrapped within GetScopedWriteLock otherwise an exception will occur.

    View Source

    UpdateContentTypesLocked(Nullable<IReadOnlyCollection<Int32>>, IReadOnlyCollection<IPublishedContentType>, IReadOnlyCollection<ContentNodeKit>)

    Updates/sets/removes data for content types

    Declaration
    public void UpdateContentTypesLocked(IReadOnlyCollection<int>? removedIds, IReadOnlyCollection<IPublishedContentType> refreshedTypes, IReadOnlyCollection<ContentNodeKit> kits)
    Parameters
    Type Name Description
    System.Nullable<IReadOnlyCollection<System.Int32>> removedIds
    IReadOnlyCollection<IPublishedContentType> refreshedTypes
    IReadOnlyCollection<ContentNodeKit> kits
    Remarks

    This methods MUST be called from within a write lock, normally wrapped within GetScopedWriteLock otherwise an exception will occur.

    View Source

    UpdateDataTypesLocked(IEnumerable<Int32>, Func<Int32, IPublishedContentType>)

    Updates data types

    Declaration
    public void UpdateDataTypesLocked(IEnumerable<int> dataTypeIds, Func<int, IPublishedContentType> getContentType)
    Parameters
    Type Name Description
    IEnumerable<System.Int32> dataTypeIds
    Func<System.Int32, IPublishedContentType> getContentType
    Remarks

    This methods MUST be called from within a write lock, normally wrapped within GetScopedWriteLock otherwise an exception will occur.

    • Improve this Doc
    • View Source
    In This Article
    • Constructors
      • ContentStore(IPublishedSnapshotAccessor, IVariationContextAccessor, ILogger, ILoggerFactory, IPublishedModelFactory, Nullable<BPlusTree<Int32, ContentNodeKit>>)
    • Properties
      • Count
      • GenCount
      • LiveSnapshot
      • SnapCount
    • Methods
      • ClearLocked(Int32)
      • CollectAsync()
      • CreateSnapshot()
      • Get(Guid, Int64)
      • Get(Int32, Int64)
      • GetAll(Int64)
      • GetAtRoot(Int64)
      • GetContentType(Guid, Int64)
      • GetContentType(Int32, Int64)
      • GetContentType(String, Int64)
      • GetScopedWriteLock(ICoreScopeProvider)
      • IsEmpty(Int64)
      • NewContentTypesLocked(IEnumerable<IPublishedContentType>)
      • ReleaseLocalDb()
      • SetAllContentTypesLocked(Nullable<IEnumerable<IPublishedContentType>>)
      • SetAllFastSortedLocked(IEnumerable<ContentNodeKit>, Boolean)
      • SetAllFastSortedLocked(IEnumerable<ContentNodeKit>, Int32, Boolean)
      • SetAllLocked(IEnumerable<ContentNodeKit>)
      • SetAllLocked(IEnumerable<ContentNodeKit>, Int32, Boolean)
      • SetBranchLocked(Int32, IEnumerable<ContentNodeKit>)
      • SetLocked(ContentNodeKit)
      • UpdateContentTypesLocked(IEnumerable<IPublishedContentType>)
      • UpdateContentTypesLocked(Nullable<IReadOnlyCollection<Int32>>, IReadOnlyCollection<IPublishedContentType>, IReadOnlyCollection<ContentNodeKit>)
      • UpdateDataTypesLocked(IEnumerable<Int32>, Func<Int32, IPublishedContentType>)
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX