• CacheManager
  • Documentation
  • Api Docs
  • MichaCo.net
    Show / Hide Table of Contents

    Class BaseCacheManager<TCacheValue>

    The BaseCacheManager<TCacheValue> implements ICacheManager<TCacheValue> and is the main class of this library. The cache manager delegates all cache operations to the list of BaseCacheHandle<TCacheValue>'s which have been added. It will keep them in sync according to rules and depending on the configuration.

    Inheritance
    Object
    BaseCache<TCacheValue>
    BaseCacheManager<TCacheValue>
    Inherited Members
    BaseCache<TCacheValue>.Disposed
    BaseCache<TCacheValue>.Disposing
    BaseCache<TCacheValue>.Item[String]
    BaseCache<TCacheValue>.Item[String, String]
    BaseCache<TCacheValue>.Add(String, TCacheValue)
    BaseCache<TCacheValue>.Add(String, TCacheValue, String)
    BaseCache<TCacheValue>.Add(CacheItem<TCacheValue>)
    BaseCache<TCacheValue>.Dispose()
    BaseCache<TCacheValue>.Get(String)
    BaseCache<TCacheValue>.Get(String, String)
    BaseCache<TCacheValue>.Get<TOut>(String)
    BaseCache<TCacheValue>.Get<TOut>(String, String)
    BaseCache<TCacheValue>.GetCacheItem(String)
    BaseCache<TCacheValue>.GetCacheItem(String, String)
    BaseCache<TCacheValue>.Put(String, TCacheValue)
    BaseCache<TCacheValue>.Put(String, TCacheValue, String)
    BaseCache<TCacheValue>.Put(CacheItem<TCacheValue>)
    BaseCache<TCacheValue>.Remove(String)
    BaseCache<TCacheValue>.Remove(String, String)
    BaseCache<TCacheValue>.CheckDisposed()
    BaseCache<TCacheValue>.GetCasted<TOut>(Object)
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace:CacheManager.Core
    Assembly:CacheManager.Core.dll
    Syntax
    public sealed class BaseCacheManager<TCacheValue> : BaseCache<TCacheValue>, ICacheManager<TCacheValue>, ICache<TCacheValue>, IDisposable
    Type Parameters
    Name Description
    TCacheValue

    The type of the cache value.

    Constructors

    | Improve this Doc View Source

    BaseCacheManager(ICacheManagerConfiguration)

    Initializes a new instance of the BaseCacheManager<TCacheValue> class using the specified configuration. If the name of the configuration is defined, the cache manager will use it. Otherwise a random string will be generated.

    Declaration
    public BaseCacheManager(ICacheManagerConfiguration configuration)
    Parameters
    Type Name Description
    ICacheManagerConfiguration configuration

    The configuration which defines the structure and complexity of the cache manager.

    Exceptions
    Type Condition
    ArgumentNullException

    When configuration is null.

    Properties

    | Improve this Doc View Source

    Backplane

    Gets the configured cache backplane.

    Declaration
    public CacheBackplane Backplane { get; }
    Property Value
    Type Description
    CacheBackplane

    The backplane.

    | Improve this Doc View Source

    CacheHandles

    Declaration
    public IEnumerable<BaseCacheHandle<TCacheValue>> CacheHandles { get; }
    Property Value
    Type Description
    IEnumerable<BaseCacheHandle<TCacheValue>>
    Implements
    ICacheManager<TCacheValue>.CacheHandles
    | Improve this Doc View Source

    Configuration

    Declaration
    public IReadOnlyCacheManagerConfiguration Configuration { get; }
    Property Value
    Type Description
    IReadOnlyCacheManagerConfiguration
    Implements
    ICacheManager<TCacheValue>.Configuration
    | Improve this Doc View Source

    Logger

    Declaration
    protected override ILogger Logger { get; }
    Property Value
    Type Description
    ILogger
    Overrides
    CacheManager.Core.Internal.BaseCache<TCacheValue>.Logger
    | Improve this Doc View Source

    Name

    Gets the cache name.

    Declaration
    public string Name { get; }
    Property Value
    Type Description
    String

    The name of the cache.

    Implements
    ICacheManager<TCacheValue>.Name

    Methods

    | Improve this Doc View Source

    AddInternal(CacheItem<TCacheValue>)

    Declaration
    protected override bool AddInternal(CacheItem<TCacheValue> item)
    Parameters
    Type Name Description
    CacheItem<TCacheValue> item
    Returns
    Type Description
    Boolean
    Overrides
    CacheManager.Core.Internal.BaseCache<TCacheValue>.AddInternal(CacheManager.Core.CacheItem<TCacheValue>)
    | Improve this Doc View Source

    AddOrUpdate(CacheItem<TCacheValue>, Func<TCacheValue, TCacheValue>)

    Declaration
    public TCacheValue AddOrUpdate(CacheItem<TCacheValue> addItem, Func<TCacheValue, TCacheValue> updateValue)
    Parameters
    Type Name Description
    CacheItem<TCacheValue> addItem
    Func<TCacheValue, TCacheValue> updateValue
    Returns
    Type Description
    TCacheValue
    Implements
    ICacheManager<TCacheValue>.AddOrUpdate(CacheItem<TCacheValue>, Func<TCacheValue, TCacheValue>)
    | Improve this Doc View Source

    AddOrUpdate(CacheItem<TCacheValue>, Func<TCacheValue, TCacheValue>, Int32)

    Declaration
    public TCacheValue AddOrUpdate(CacheItem<TCacheValue> addItem, Func<TCacheValue, TCacheValue> updateValue, int maxRetries)
    Parameters
    Type Name Description
    CacheItem<TCacheValue> addItem
    Func<TCacheValue, TCacheValue> updateValue
    Int32 maxRetries
    Returns
    Type Description
    TCacheValue
    Implements
    ICacheManager<TCacheValue>.AddOrUpdate(CacheItem<TCacheValue>, Func<TCacheValue, TCacheValue>, Int32)
    | Improve this Doc View Source

    AddOrUpdate(String, TCacheValue, Func<TCacheValue, TCacheValue>)

    Declaration
    public TCacheValue AddOrUpdate(string key, TCacheValue addValue, Func<TCacheValue, TCacheValue> updateValue)
    Parameters
    Type Name Description
    String key
    TCacheValue addValue
    Func<TCacheValue, TCacheValue> updateValue
    Returns
    Type Description
    TCacheValue
    Implements
    ICacheManager<TCacheValue>.AddOrUpdate(String, TCacheValue, Func<TCacheValue, TCacheValue>)
    | Improve this Doc View Source

    AddOrUpdate(String, TCacheValue, Func<TCacheValue, TCacheValue>, Int32)

    Declaration
    public TCacheValue AddOrUpdate(string key, TCacheValue addValue, Func<TCacheValue, TCacheValue> updateValue, int maxRetries)
    Parameters
    Type Name Description
    String key
    TCacheValue addValue
    Func<TCacheValue, TCacheValue> updateValue
    Int32 maxRetries
    Returns
    Type Description
    TCacheValue
    Implements
    ICacheManager<TCacheValue>.AddOrUpdate(String, TCacheValue, Func<TCacheValue, TCacheValue>, Int32)
    | Improve this Doc View Source

    AddOrUpdate(String, String, TCacheValue, Func<TCacheValue, TCacheValue>)

    Declaration
    public TCacheValue AddOrUpdate(string key, string region, TCacheValue addValue, Func<TCacheValue, TCacheValue> updateValue)
    Parameters
    Type Name Description
    String key
    String region
    TCacheValue addValue
    Func<TCacheValue, TCacheValue> updateValue
    Returns
    Type Description
    TCacheValue
    Implements
    ICacheManager<TCacheValue>.AddOrUpdate(String, String, TCacheValue, Func<TCacheValue, TCacheValue>)
    | Improve this Doc View Source

    AddOrUpdate(String, String, TCacheValue, Func<TCacheValue, TCacheValue>, Int32)

    Declaration
    public TCacheValue AddOrUpdate(string key, string region, TCacheValue addValue, Func<TCacheValue, TCacheValue> updateValue, int maxRetries)
    Parameters
    Type Name Description
    String key
    String region
    TCacheValue addValue
    Func<TCacheValue, TCacheValue> updateValue
    Int32 maxRetries
    Returns
    Type Description
    TCacheValue
    Implements
    ICacheManager<TCacheValue>.AddOrUpdate(String, String, TCacheValue, Func<TCacheValue, TCacheValue>, Int32)
    | Improve this Doc View Source

    Clear()

    Declaration
    public override void Clear()
    Overrides
    CacheManager.Core.Internal.BaseCache<TCacheValue>.Clear()
    Implements
    ICache<TCacheValue>.Clear()
    | Improve this Doc View Source

    ClearRegion(String)

    Declaration
    public override void ClearRegion(string region)
    Parameters
    Type Name Description
    String region
    Overrides
    CacheManager.Core.Internal.BaseCache<TCacheValue>.ClearRegion(System.String)
    Implements
    ICache<TCacheValue>.ClearRegion(String)
    | Improve this Doc View Source

    Dispose(Boolean)

    Declaration
    protected override void Dispose(bool disposeManaged)
    Parameters
    Type Name Description
    Boolean disposeManaged
    Overrides
    CacheManager.Core.Internal.BaseCache<TCacheValue>.Dispose(System.Boolean)
    | Improve this Doc View Source

    Exists(String)

    Declaration
    public override bool Exists(string key)
    Parameters
    Type Name Description
    String key
    Returns
    Type Description
    Boolean
    Overrides
    CacheManager.Core.Internal.BaseCache<TCacheValue>.Exists(System.String)
    Implements
    ICache<TCacheValue>.Exists(String)
    | Improve this Doc View Source

    Exists(String, String)

    Declaration
    public override bool Exists(string key, string region)
    Parameters
    Type Name Description
    String key
    String region
    Returns
    Type Description
    Boolean
    Overrides
    CacheManager.Core.Internal.BaseCache<TCacheValue>.Exists(System.String, System.String)
    Implements
    ICache<TCacheValue>.Exists(String, String)
    | Improve this Doc View Source

    Expire(String, ExpirationMode, TimeSpan)

    Declaration
    public void Expire(string key, ExpirationMode mode, TimeSpan timeout)
    Parameters
    Type Name Description
    String key
    ExpirationMode mode
    TimeSpan timeout
    Implements
    ICacheManager<TCacheValue>.Expire(String, ExpirationMode, TimeSpan)
    | Improve this Doc View Source

    Expire(String, DateTimeOffset)

    Declaration
    public void Expire(string key, DateTimeOffset absoluteExpiration)
    Parameters
    Type Name Description
    String key
    DateTimeOffset absoluteExpiration
    Implements
    ICacheManager<TCacheValue>.Expire(String, DateTimeOffset)
    | Improve this Doc View Source

    Expire(String, String, ExpirationMode, TimeSpan)

    Declaration
    public void Expire(string key, string region, ExpirationMode mode, TimeSpan timeout)
    Parameters
    Type Name Description
    String key
    String region
    ExpirationMode mode
    TimeSpan timeout
    Implements
    ICacheManager<TCacheValue>.Expire(String, String, ExpirationMode, TimeSpan)
    | Improve this Doc View Source

    Expire(String, String, DateTimeOffset)

    Declaration
    public void Expire(string key, string region, DateTimeOffset absoluteExpiration)
    Parameters
    Type Name Description
    String key
    String region
    DateTimeOffset absoluteExpiration
    Implements
    ICacheManager<TCacheValue>.Expire(String, String, DateTimeOffset)
    | Improve this Doc View Source

    Expire(String, String, TimeSpan)

    Declaration
    public void Expire(string key, string region, TimeSpan slidingExpiration)
    Parameters
    Type Name Description
    String key
    String region
    TimeSpan slidingExpiration
    Implements
    ICacheManager<TCacheValue>.Expire(String, String, TimeSpan)
    | Improve this Doc View Source

    Expire(String, TimeSpan)

    Declaration
    public void Expire(string key, TimeSpan slidingExpiration)
    Parameters
    Type Name Description
    String key
    TimeSpan slidingExpiration
    Implements
    ICacheManager<TCacheValue>.Expire(String, TimeSpan)
    | Improve this Doc View Source

    GetCacheItemInternal(String)

    Declaration
    protected override CacheItem<TCacheValue> GetCacheItemInternal(string key)
    Parameters
    Type Name Description
    String key
    Returns
    Type Description
    CacheItem<TCacheValue>
    Overrides
    CacheManager.Core.Internal.BaseCache<TCacheValue>.GetCacheItemInternal(System.String)
    | Improve this Doc View Source

    GetCacheItemInternal(String, String)

    Declaration
    protected override CacheItem<TCacheValue> GetCacheItemInternal(string key, string region)
    Parameters
    Type Name Description
    String key
    String region
    Returns
    Type Description
    CacheItem<TCacheValue>
    Overrides
    CacheManager.Core.Internal.BaseCache<TCacheValue>.GetCacheItemInternal(System.String, System.String)
    | Improve this Doc View Source

    GetOrAdd(String, TCacheValue)

    Declaration
    public TCacheValue GetOrAdd(string key, TCacheValue value)
    Parameters
    Type Name Description
    String key
    TCacheValue value
    Returns
    Type Description
    TCacheValue
    Implements
    ICacheManager<TCacheValue>.GetOrAdd(String, TCacheValue)
    | Improve this Doc View Source

    GetOrAdd(String, Func<String, TCacheValue>)

    Declaration
    public TCacheValue GetOrAdd(string key, Func<string, TCacheValue> valueFactory)
    Parameters
    Type Name Description
    String key
    Func<String, TCacheValue> valueFactory
    Returns
    Type Description
    TCacheValue
    Implements
    ICacheManager<TCacheValue>.GetOrAdd(String, Func<String, TCacheValue>)
    | Improve this Doc View Source

    GetOrAdd(String, String, TCacheValue)

    Declaration
    public TCacheValue GetOrAdd(string key, string region, TCacheValue value)
    Parameters
    Type Name Description
    String key
    String region
    TCacheValue value
    Returns
    Type Description
    TCacheValue
    Implements
    ICacheManager<TCacheValue>.GetOrAdd(String, String, TCacheValue)
    | Improve this Doc View Source

    GetOrAdd(String, String, Func<String, String, TCacheValue>)

    Declaration
    public TCacheValue GetOrAdd(string key, string region, Func<string, string, TCacheValue> valueFactory)
    Parameters
    Type Name Description
    String key
    String region
    Func<String, String, TCacheValue> valueFactory
    Returns
    Type Description
    TCacheValue
    Implements
    ICacheManager<TCacheValue>.GetOrAdd(String, String, Func<String, String, TCacheValue>)
    | Improve this Doc View Source

    PutInternal(CacheItem<TCacheValue>)

    Declaration
    protected override void PutInternal(CacheItem<TCacheValue> item)
    Parameters
    Type Name Description
    CacheItem<TCacheValue> item
    Overrides
    CacheManager.Core.Internal.BaseCache<TCacheValue>.PutInternal(CacheManager.Core.CacheItem<TCacheValue>)
    | Improve this Doc View Source

    RemoveExpiration(String)

    Declaration
    public void RemoveExpiration(string key)
    Parameters
    Type Name Description
    String key
    Implements
    ICacheManager<TCacheValue>.RemoveExpiration(String)
    | Improve this Doc View Source

    RemoveExpiration(String, String)

    Declaration
    public void RemoveExpiration(string key, string region)
    Parameters
    Type Name Description
    String key
    String region
    Implements
    ICacheManager<TCacheValue>.RemoveExpiration(String, String)
    | Improve this Doc View Source

    RemoveInternal(String)

    Declaration
    protected override bool RemoveInternal(string key)
    Parameters
    Type Name Description
    String key
    Returns
    Type Description
    Boolean
    Overrides
    CacheManager.Core.Internal.BaseCache<TCacheValue>.RemoveInternal(System.String)
    | Improve this Doc View Source

    RemoveInternal(String, String)

    Declaration
    protected override bool RemoveInternal(string key, string region)
    Parameters
    Type Name Description
    String key
    String region
    Returns
    Type Description
    Boolean
    Overrides
    CacheManager.Core.Internal.BaseCache<TCacheValue>.RemoveInternal(System.String, System.String)
    | Improve this Doc View Source

    ToString()

    Returns a String that represents this instance.

    Declaration
    public override string ToString()
    Returns
    Type Description
    String

    A String that represents this instance.

    Overrides
    Object.ToString()
    | Improve this Doc View Source

    TryGetOrAdd(String, Func<String, TCacheValue>, out TCacheValue)

    Declaration
    public bool TryGetOrAdd(string key, Func<string, TCacheValue> valueFactory, out TCacheValue value)
    Parameters
    Type Name Description
    String key
    Func<String, TCacheValue> valueFactory
    TCacheValue value
    Returns
    Type Description
    Boolean
    Implements
    ICacheManager<TCacheValue>.TryGetOrAdd(String, Func<String, TCacheValue>, out TCacheValue)
    | Improve this Doc View Source

    TryGetOrAdd(String, String, Func<String, String, TCacheValue>, out TCacheValue)

    Declaration
    public bool TryGetOrAdd(string key, string region, Func<string, string, TCacheValue> valueFactory, out TCacheValue value)
    Parameters
    Type Name Description
    String key
    String region
    Func<String, String, TCacheValue> valueFactory
    TCacheValue value
    Returns
    Type Description
    Boolean
    Implements
    ICacheManager<TCacheValue>.TryGetOrAdd(String, String, Func<String, String, TCacheValue>, out TCacheValue)
    | Improve this Doc View Source

    TryUpdate(String, Func<TCacheValue, TCacheValue>, out TCacheValue)

    Declaration
    public bool TryUpdate(string key, Func<TCacheValue, TCacheValue> updateValue, out TCacheValue value)
    Parameters
    Type Name Description
    String key
    Func<TCacheValue, TCacheValue> updateValue
    TCacheValue value
    Returns
    Type Description
    Boolean
    Implements
    ICacheManager<TCacheValue>.TryUpdate(String, Func<TCacheValue, TCacheValue>, out TCacheValue)
    | Improve this Doc View Source

    TryUpdate(String, Func<TCacheValue, TCacheValue>, Int32, out TCacheValue)

    Declaration
    public bool TryUpdate(string key, Func<TCacheValue, TCacheValue> updateValue, int maxRetries, out TCacheValue value)
    Parameters
    Type Name Description
    String key
    Func<TCacheValue, TCacheValue> updateValue
    Int32 maxRetries
    TCacheValue value
    Returns
    Type Description
    Boolean
    Implements
    ICacheManager<TCacheValue>.TryUpdate(String, Func<TCacheValue, TCacheValue>, Int32, out TCacheValue)
    | Improve this Doc View Source

    TryUpdate(String, String, Func<TCacheValue, TCacheValue>, out TCacheValue)

    Declaration
    public bool TryUpdate(string key, string region, Func<TCacheValue, TCacheValue> updateValue, out TCacheValue value)
    Parameters
    Type Name Description
    String key
    String region
    Func<TCacheValue, TCacheValue> updateValue
    TCacheValue value
    Returns
    Type Description
    Boolean
    Implements
    ICacheManager<TCacheValue>.TryUpdate(String, String, Func<TCacheValue, TCacheValue>, out TCacheValue)
    | Improve this Doc View Source

    TryUpdate(String, String, Func<TCacheValue, TCacheValue>, Int32, out TCacheValue)

    Declaration
    public bool TryUpdate(string key, string region, Func<TCacheValue, TCacheValue> updateValue, int maxRetries, out TCacheValue value)
    Parameters
    Type Name Description
    String key
    String region
    Func<TCacheValue, TCacheValue> updateValue
    Int32 maxRetries
    TCacheValue value
    Returns
    Type Description
    Boolean
    Implements
    ICacheManager<TCacheValue>.TryUpdate(String, String, Func<TCacheValue, TCacheValue>, Int32, out TCacheValue)
    | Improve this Doc View Source

    Update(String, Func<TCacheValue, TCacheValue>)

    Declaration
    public TCacheValue Update(string key, Func<TCacheValue, TCacheValue> updateValue)
    Parameters
    Type Name Description
    String key
    Func<TCacheValue, TCacheValue> updateValue
    Returns
    Type Description
    TCacheValue
    Implements
    ICacheManager<TCacheValue>.Update(String, Func<TCacheValue, TCacheValue>)
    | Improve this Doc View Source

    Update(String, Func<TCacheValue, TCacheValue>, Int32)

    Declaration
    public TCacheValue Update(string key, Func<TCacheValue, TCacheValue> updateValue, int maxRetries)
    Parameters
    Type Name Description
    String key
    Func<TCacheValue, TCacheValue> updateValue
    Int32 maxRetries
    Returns
    Type Description
    TCacheValue
    Implements
    ICacheManager<TCacheValue>.Update(String, Func<TCacheValue, TCacheValue>, Int32)
    | Improve this Doc View Source

    Update(String, String, Func<TCacheValue, TCacheValue>)

    Declaration
    public TCacheValue Update(string key, string region, Func<TCacheValue, TCacheValue> updateValue)
    Parameters
    Type Name Description
    String key
    String region
    Func<TCacheValue, TCacheValue> updateValue
    Returns
    Type Description
    TCacheValue
    Implements
    ICacheManager<TCacheValue>.Update(String, String, Func<TCacheValue, TCacheValue>)
    | Improve this Doc View Source

    Update(String, String, Func<TCacheValue, TCacheValue>, Int32)

    Declaration
    public TCacheValue Update(string key, string region, Func<TCacheValue, TCacheValue> updateValue, int maxRetries)
    Parameters
    Type Name Description
    String key
    String region
    Func<TCacheValue, TCacheValue> updateValue
    Int32 maxRetries
    Returns
    Type Description
    TCacheValue
    Implements
    ICacheManager<TCacheValue>.Update(String, String, Func<TCacheValue, TCacheValue>, Int32)

    Events

    | Improve this Doc View Source

    OnAdd

    Declaration
    public event EventHandler<CacheActionEventArgs> OnAdd
    Event Type
    Type Description
    EventHandler<CacheActionEventArgs>
    Implements
    ICacheManager<TCacheValue>.OnAdd
    | Improve this Doc View Source

    OnClear

    Declaration
    public event EventHandler<CacheClearEventArgs> OnClear
    Event Type
    Type Description
    EventHandler<CacheClearEventArgs>
    Implements
    ICacheManager<TCacheValue>.OnClear
    | Improve this Doc View Source

    OnClearRegion

    Declaration
    public event EventHandler<CacheClearRegionEventArgs> OnClearRegion
    Event Type
    Type Description
    EventHandler<CacheClearRegionEventArgs>
    Implements
    ICacheManager<TCacheValue>.OnClearRegion
    | Improve this Doc View Source

    OnGet

    Declaration
    public event EventHandler<CacheActionEventArgs> OnGet
    Event Type
    Type Description
    EventHandler<CacheActionEventArgs>
    Implements
    ICacheManager<TCacheValue>.OnGet
    | Improve this Doc View Source

    OnPut

    Declaration
    public event EventHandler<CacheActionEventArgs> OnPut
    Event Type
    Type Description
    EventHandler<CacheActionEventArgs>
    Implements
    ICacheManager<TCacheValue>.OnPut
    | Improve this Doc View Source

    OnRemove

    Declaration
    public event EventHandler<CacheActionEventArgs> OnRemove
    Event Type
    Type Description
    EventHandler<CacheActionEventArgs>
    Implements
    ICacheManager<TCacheValue>.OnRemove
    | Improve this Doc View Source

    OnRemoveByHandle

    Declaration
    public event EventHandler<CacheItemRemovedEventArgs> OnRemoveByHandle
    Event Type
    Type Description
    EventHandler<CacheItemRemovedEventArgs>
    Implements
    ICacheManager<TCacheValue>.OnRemoveByHandle
    | Improve this Doc View Source

    OnUpdate

    Declaration
    public event EventHandler<CacheActionEventArgs> OnUpdate
    Event Type
    Type Description
    EventHandler<CacheActionEventArgs>
    Implements
    ICacheManager<TCacheValue>.OnUpdate
    • Improve this Doc
    • View Source
    © 2025 by Michael Conrad. All rights reserved. - MichaCo.net