Innovt Platform
Search Results for

    Show / Hide Table of Contents

    Class LocalCache

    Represents a local caching service that implements the ICacheService interface using an in-memory cache provided by IMemoryCache.

    Inheritance
    object
    LocalCache
    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 LocalCache : ICacheService, IDisposable
    Remarks

    This class provides a concrete implementation of the ICacheService interface using an in-memory cache for storing and retrieving data. It is designed for local caching within an application.

    Constructors

    | Edit this page View Source

    LocalCache(IMemoryCache)

    Initializes a new instance of the LocalCache class with the specified IMemoryCache.

    Declaration
    public LocalCache(IMemoryCache memoryCache)
    Parameters
    Type Name Description
    IMemoryCache memoryCache

    The in-memory cache implementation provided by IMemoryCache.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when memoryCache 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

    ~LocalCache()

    Finalizes an instance of the LocalCache class.

    Declaration
    protected ~LocalCache()
    | 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