CacheManager is an open source caching abstraction layer for .NET written in C#. It supports various cache providers and implements many advanced features.
I'm using CacheManager with L1 memory cache and L2 Redis distributed cache. See sample config below. Let's say for an example that I'm using sliding expiration of 5 minutes for both in the config.
It looks like I might be able to override the mode and expiration of individual entries at the time their added with something like:
I'm assuming both the L1 and L2 caches would honor the expiration of items set this way. Is this correct?
I do see L2 entries have the settings in Redis:
But I can't easily see the L2 in-memory cache. Does it do the same?
Thanks!
{
"maxRetries": 1000,
"name": "nonExpiring",
"retryTimeout": 100,
"updateMode": "Up",
"loggerFactory": {
"knownType": "Microsoft"
},
"serializer": {
"knownType": "Json"
},
"handles": [
// L2 settings
// Seems like can be overridden individually with CacheManager.Add(new CacheItem(key,val,MODE,TIMESPAN))
{
"knownType": "Redis",
"key": "redisConnection",
"enablePerformanceCounters": false,
"enableStatistics": false,
"isBackplaneSource": true,
"expirationMode": "Sliding",
"expirationTimeout": "0:5:00"
},
// L1 settings
// only way to configure L1 ExpirationMode and ExpirationTimeout is here (no way to do this in code); see https://github.com/MichaCo/CacheManager/issues/177
// Can this also be overridden individually with CacheManager.Add(new CacheItem(key,val,MODE,TIMESPAN)) ??
{
"knownType": "SystemRuntime",
"enablePerformanceCounters": false,
"enableStatistics": false,
"expirationMode": "Sliding",
"expirationTimeout": "0:5:00",
"isBackplaneSource": false
}
]
}
Hi Michael!
Thanks again for such a great product.
I'm using CacheManager with L1 memory cache and L2 Redis distributed cache. See sample config below. Let's say for an example that I'm using sliding expiration of 5 minutes for both in the config.
It looks like I might be able to override the mode and expiration of individual entries at the time their added with something like:
I'm assuming both the L1 and L2 caches would honor the expiration of items set this way. Is this correct?
I do see L2 entries have the settings in Redis:
But I can't easily see the L2 in-memory cache. Does it do the same?
Thanks!