Search Results for

    Show / Hide Table of Contents
    View Source

    Class HttpContextRequestAppCache

    Implements a IAppCache on top of Microsoft.AspNetCore.Http.IHttpContextAccessor

    Inheritance
    object
    FastDictionaryAppCacheBase
    Namespace: Umbraco.Cms.Core.Cache
    Assembly: Umbraco.Web.Common.dll
    Syntax
    public class HttpContextRequestAppCache : FastDictionaryAppCacheBase, IRequestCache, IAppCache
    Remarks

    The HttpContext is not thread safe and no part of it is which means we need to include our own thread safety mechanisms. This relies on notifications: UmbracoRequestBeginNotification and UmbracoRequestEndNotification in order to facilitate the correct locking and releasing allocations.

    Constructors

    View Source

    HttpContextRequestAppCache(IHttpContextAccessor)

    Initializes a new instance of the HttpContextRequestAppCache class with a context, for unit tests!

    Declaration
    public HttpContextRequestAppCache(IHttpContextAccessor httpContextAccessor)
    Parameters
    Type Name Description
    IHttpContextAccessor httpContextAccessor

    Properties

    View Source

    IsAvailable

    Returns true if the request cache is available otherwise false

    Declaration
    public bool IsAvailable { get; }
    Property Value
    Type Description
    bool

    Methods

    View Source

    EnterReadLock()

    Declaration
    protected override void EnterReadLock()
    View Source

    EnterWriteLock()

    Declaration
    protected override void EnterWriteLock()
    View Source

    ExitReadLock()

    Declaration
    protected override void ExitReadLock()
    View Source

    ExitWriteLock()

    Declaration
    protected override void ExitWriteLock()
    View Source

    Get(string, Func<object?>)

    Gets or creates an item identified by its key.

    Declaration
    public override object? Get(string key, Func<object?> factory)
    Parameters
    Type Name Description
    string key

    The key of the item.

    Func<object> factory

    A factory function that can create the item.

    Returns
    Type Description
    object

    The item.

    Remarks

    Null values returned from the factory function are never cached.

    View Source

    GetDictionaryEntries()

    Declaration
    protected override IEnumerable<KeyValuePair<object, object>> GetDictionaryEntries()
    Returns
    Type Description
    IEnumerable<KeyValuePair<object, object>>
    View Source

    GetEntry(string)

    Declaration
    protected override object? GetEntry(string key)
    Parameters
    Type Name Description
    string key
    Returns
    Type Description
    object
    View Source

    GetEnumerator()

    Returns an enumerator that iterates through the collection.

    Declaration
    public IEnumerator<KeyValuePair<string, object?>> GetEnumerator()
    Returns
    Type Description
    IEnumerator<KeyValuePair<string, object>>

    An enumerator that can be used to iterate through the collection.

    View Source

    Remove(string)

    Declaration
    public bool Remove(string key)
    Parameters
    Type Name Description
    string key
    Returns
    Type Description
    bool
    View Source

    RemoveEntry(string)

    Declaration
    protected override void RemoveEntry(string key)
    Parameters
    Type Name Description
    string key
    View Source

    Set(string, object?)

    Declaration
    public bool Set(string key, object? value)
    Parameters
    Type Name Description
    string key
    object value
    Returns
    Type Description
    bool
    • Edit this page
    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX