Skip to content

CacheManager is a common interface and abstraction layer for caching written in C#. It supports various cache providers and implements many advanced features.

License

Notifications You must be signed in to change notification settings

modulexcite/CacheManager

 
 

Repository files navigation

CacheManager

CacheManager is an open source abstraction layer for caching written in C#. It supports various cache providers and implements many advanced features.

The main goal of the CacheManager package is to make developer's life easier to handle even very complex caching scenarios.
With CacheManager it is possible to implement multiple layers of caching, e.g. in-process caching in front of a distributed cache, in just a few lines of code.

CacheManager is not just an interface to unify the programming model for various cache providers, which will make it very easy to change the caching strategy later on in a project. It also offers additional features, like cache synchronization, concurrent updates, serialization, events, performance counters... The developer can opt-in to those features only if needed.

Build Status

Build Server Status
Windows, KoreBuild Build status
Windows, MSBuild Build status
Linux, Mono Build Status

CacheManager Nuget Packages

Package Name .Net 4.0 .Net 4.5 DNX 4.5.1 Dotnet 5.2
[CacheManager.Core] Core.nuget x x x x
[CacheManager.Serialization.Json] Json.nuget x x x x
[CacheManager.StackExchange.Redis] Redis.nuget x x x -
[CacheManager.SystemRuntimeCaching] SystemRuntimeCaching.nuget x x x -
[CacheManager.Memcached] Memcached.nuget x x x -
[CacheManager.Web] Web.nuget - x x -
[CacheManager.Couchbase] Couchbase.nuget - x x -

Beta Packages

Beta versions of the CacheManager packages are getting pushed to https://www.myget.org/gallery/cachemanager on each build. Add the following feed, if you want to play with the not yet released bits:

https://www.myget.org/F/cachemanager/api/v3/index.json

To find which checkin created which build, use this build history.

Documentation

Documentation can be found within the articles folder of the Cache Manager's repository and hosted on my website:

There is also from source generated html documentation available online.

Examples

Features in Version: 0.7.x

  • One common interface for handling different caching technologies: ICache<T>
  • Configurable via app/web.config or by code.
  • Support for different cache providers
  • Serialization can be configured per cache handle. Serialization is only needed in distributed caches. The default implementation uses binary serialization. The Serialization.Json packages provides a Newtonsoft.Json based alternative.
  • Update values with lock or transaction for distributed caches. The interfaced provides a simple update method which internally ensures you work with the latest version. And CacheManager handles version conflicts for you.
  • Strongly typed cache interface.
  • Multiple layers By having multiple cache handles managed by CacheManager, you can easily implement layered caches. For example an in process cache infront of your distributed cache, to make read access faster. CacheManager will synchronize those layers for you.
    • Put and Add operations will always be excecuted on all cache handles registered on the manager.
    • On Get, there are different configuration options defined by CacheUpdateMode, if the item was available in one cache handle:
      • None: No update across the cache handles on Get
      • Up: Updates the handles "above"
      • All: Updates/Adds the item to all handles
  • Expiration: It is possible to configure the expiration per cache handle within the manager or per cache item. The following are the supported expiration modes:
    • Sliding expiration: On cache hit, the cache item expiration timeout will be extended by the configured amount.
    • Absolute expiration: The cache item will expire after the configured timeout.
  • Cache Regions: Even if some cache systems do not support or implement cache regions, the CacheManager implements the mechanism. This can be used to for example group elements and remove all of them at once.
  • Statistics: Counters for all kind of cache actions.
  • Performance Counters: To be able to inspect certain numbers with perfmon, CacheManager supports performance counters per instance of the manager and per cache handle.
  • Event System: CacheManager triggers events for common cache actions: OnGet, OnAdd, OnPut, OnRemove, OnClear, OnClearRegion
  • System.Web.OutputCache implementation to use CacheManager as OutputCache provider which makes the OutputCache extremly flexible, for example by using a distributed cache like Redis across many web servers.
  • Cache clients synchronization
    • Implemented with the Redis pub/sub feature
    • (Other implementations without Redis might be an option for a later version)
  • Supports .Net 4.0, .Net 4.5, ASP.NET DNX 4.5.1 and Core

[TOC]

About

CacheManager is a common interface and abstraction layer for caching written in C#. It supports various cache providers and implements many advanced features.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 99.5%
  • Other 0.5%