Blended Cache Framework for .net
Basic Principles:
- 3 layers of caching:
- Context (Thread based)
- Volatile (in memory)
- LongTerm (out of process)
- Wraps up interaction of 3 layers, back filling. eg found in longTerm, put in context, volatile
- Provides flush mode support for forcing refreshes at various layers.
- Allows type load configuration to auto-load items.
- LongTerm supports Refresh and Absolute expiration time. Also background refresh support with TypeLoadConfig
- LongTerm supports Database down Func<bool> parameter to by pass expiration and keep system running.
- LongTerm ideal permanent distributed cacheStore such as memcached, azure, etc.
Sample Context and Volatile for a website.
var contextCache = new HttpContextCache(); // IContextCache
var volatileCache = new RuntimeMemoryCachingVolatileCache();
var configuration = new BlendedCacheConfiguration();
//fancy ioc stuff here.
return new BlendedCache(contextCache, volatileCache, NullLongTermCache.NullInstance, configuration);
NuGet auto-download is required to be configured to supply any third-parties.
- Tools -> Options -> Package Manager
- Check the box that says "Allow NuGet to download missing packages during build"