Skip to content

Latest commit

 

History

History
64 lines (41 loc) · 1.56 KB

README.md

File metadata and controls

64 lines (41 loc) · 1.56 KB

Caching Manager (.NET CORE 2.0)

It's a wrapper library for [Microsoft.Extensions.Caching.Memory.MemoryCache] targeting .net core 2.0, allow you to create multiple instances from MemoryCache Type and keep them all under your control in a centralized-place which is CacheManager.

Build Server

Build status

NuGet Package

This project is available as NuGet package being updated after each successfull build (continuous integration).

You can navigate to NuGet link https://www.nuget.org/packages/CachingManager

You can also install to your project as simple as :

PM> Install-Package CachingManager

Kick-start

  • How to create new cache instance
using CachingManager;

var cache = CacheFactory.CreateCache<User, int>("Users cache", 10 * 1024);
  • How to cache and retreive an object
var user = new User() {Id = 10, Name = "Alden" };

cache[user.Id] = user;

var cachedCopy = cache[user.Id];
  • How to get list of existing caches.
List<ICache> caches = CacheManager.Instance.ListCaches();

foreach (var cache in caches)
{
   // clear cache
   cache.Clear();

   //cache properties
   string name = cache.Name;
   long sizeLimit = cache.SizeLimit;
}
  • How to clear all caches
CacheManager.Instance.ClearAll();

Contribute to this repository

Feel free to contribute to this repository, you can reach me out by the email [email protected]