Skip to content

PixsysBE/Pixsys.Library.Cache.CacheManager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Cache Manager

This manager handles cache

1. Installation

1.1 Register the services in Program.cs

using Pixsys.Library.Cache.CacheManager;

WebApplicationBuilder builder = WebApplication.CreateBuilder(args);

builder.AddCacheManager();

1.2 Usage

1.2.1 Inject the required service into your controller

private readonly ICacheManager _cacheManager;

public MyController(ICacheManager cacheManager)
{
    _cacheManager = cacheManager;
}

1.2.2 Methods

var tpr = cacheManager.GetFromCache<TickerPricesResult>(pavAtDate.l_tickerPriceResult);
if (tpr == null)
{
    tpr = context.TickerPricesResults.Find(pavAtDate.l_tickerPriceResult);
    cacheManager.AddToCache<TickerPricesResult>(pavAtDate.l_tickerPriceResult, tpr);
}

About

An implementation of a cache manager using lock based sync (CacheSyncLock) to handle concurrent accesses to the CacheManagers dictionary.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages