almez / CachingManager

CachingManager is a library for .NET CORE 2.0. Has been built on top of [Microsoft.Extensions.Caching.Memory.MemoryCache]. Enables you to create multiple instances of MemoryCache in your application and keep them all under your control in centralized place which is CacheManager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 eng.ngmalden@gmail.com

About

CachingManager is a library for .NET CORE 2.0. Has been built on top of [Microsoft.Extensions.Caching.Memory.MemoryCache]. Enables you to create multiple instances of MemoryCache in your application and keep them all under your control in centralized place which is CacheManager

License:MIT License


Languages

Language:C# 63.9%Language:PowerShell 36.1%