Innovt Platform
Search Results for

    Show / Hide Table of Contents

    Class MultiLayerCacheService

    Represents a multi-layer caching service that implements the ICacheService interface.

    Inheritance
    object
    MultiLayerCacheService
    Implements
    ICacheService
    IDisposable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Innovt.Core.Caching
    Assembly: Innovt.Core.dll
    Syntax
    public sealed class MultiLayerCacheService : ICacheService, IDisposable
    Remarks

    This class provides a caching service that supports multiple caching layers. It allows data retrieval and storage through a series of cache layers, falling back to subsequent layers if data is not found in earlier layers.

    Constructors

    | Edit this page View Source

    MultiLayerCacheService(ICacheService, ICacheService, ILogger)

    Initializes a new instance of the MultiLayerCacheService class with multiple caching layers.

    Declaration
    public MultiLayerCacheService(ICacheService cacheDefaultLayer, ICacheService cacheSecondLayer, ILogger logger)
    Parameters
    Type Name Description
    ICacheService cacheDefaultLayer

    The default caching layer implementing ICacheService.

    ICacheService cacheSecondLayer

    The secondary caching layer implementing ICacheService.

    ILogger logger

    The logger implementation provided by ILogger.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when cacheDefaultLayer, cacheSecondLayer, or logger is null.

    | Edit this page View Source

    MultiLayerCacheService(ICacheService, ILogger)

    Initializes a new instance of the MultiLayerCacheService class with a default caching layer.

    Declaration
    public MultiLayerCacheService(ICacheService cacheDefaultLayer, ILogger logger)
    Parameters
    Type Name Description
    ICacheService cacheDefaultLayer

    The default caching layer implementing ICacheService.

    ILogger logger

    The logger implementation provided by ILogger.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when cacheDefaultLayer or logger is null.

    Methods

    | Edit this page View Source

    Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

    Declaration
    public void Dispose()
    | Edit this page View Source

    ~MultiLayerCacheService()

    Finalizes an instance of the MultiLayerCacheService class.

    Declaration
    protected ~MultiLayerCacheService()
    | Edit this page View Source

    GetValue<T>(string)

    Gets the cached value associated with the specified key.

    Declaration
    public T GetValue<T>(string key)
    Parameters
    Type Name Description
    string key

    The unique identifier for the cached item.

    Returns
    Type Description
    T

    The cached value if found; otherwise, the default value for the type.

    Type Parameters
    Name Description
    T

    The type of the cached value.

    | Edit this page View Source

    Remove(string)

    Removes a cached value associated with the specified key.

    Declaration
    public void Remove(string key)
    Parameters
    Type Name Description
    string key

    The unique identifier for the cached item to be removed.

    | Edit this page View Source

    SetValue<T>(string, T, TimeSpan)

    Sets a value in the cache with the specified key and expiration duration.

    Declaration
    public void SetValue<T>(string key, T entity, TimeSpan expiration)
    Parameters
    Type Name Description
    string key

    The unique identifier for the cached item.

    T entity

    The value to be cached.

    TimeSpan expiration

    The time duration for which the value should be cached.

    Type Parameters
    Name Description
    T

    The type of the value to be cached.

    Implements

    ICacheService
    IDisposable

    Extension Methods

    Extensions.IsNull(object)
    Extensions.ToStringOrDefault(object)
    SimpleMapper.MapTo<T1>(object)
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX