MichaCo / CacheManager

CacheManager is an open source caching abstraction layer for .NET written in C#. It supports various cache providers and implements many advanced features.
http://cachemanager.michaco.net
Apache License 2.0
2.34k stars 457 forks source link

Feature Request: Sharing cache handles - so they store keys with same prefix #250

Open shahjay748 opened 5 years ago

shahjay748 commented 5 years ago

How can we use handle of existing ICacheManager in configuring new ICacheManager ? Currently, If we create two instance of ICacheManager and use the SystemRuntimeCacheHandle in both, it's still creates two different hanldes. Seems like you're prepending some UniqueId while storing keys, so keys are not getting shared between both instances. Is there any way of sharing cache handles - so they store keys with same prefix ?

The reason for this requirement is - when distributed cache stops working, we still want to keep our app working with memory cache and we've implemented that by referring http://michaco.net/blog/WhatIfRedisStopsWorkingHowDoIkeepMyAppRunning.

But the problem is - when we move to memory cache from distributed cache, all keys which were already there in memory cache are not accessible by separate memory cache handle.

We can fix this if somehow we can use same handle(which uses same UniqueId prefix) in both instances of CacheManager i.e. distributed and inMemory - so we don't loose access to existing memory cache when distributed cache stops.

Can you please add this feature ?