Redis backPlate doesn't work when configured from config file.
I am using following configuration in web.config:
<configSections>
<section name="cacheManager" type="CacheManager.Core.Configuration.CacheManagerSection, CacheManager.Core" />
<section name="cacheManager.Redis" type="CacheManager.Redis.RedisConfigurationSection, CacheManager.StackExchange.Redis" />
</configSections>
<cacheManager.Redis>
<connections>
<connection id="redis1" database="0" >
<endpoints>
<endpoint host="127.0.0.1" port="6379" />
</endpoints>
</connection>
</connections>
</cacheManager.Redis>
<cacheManager xmlns="http://tempuri.org/CacheManagerCfg.xsd">
<managers>
<cache name="redisWithBackPlate" enableStatistics="false" backPlateName="redis1" backPlateType="CacheManager.StackExchange.Redis.RedisCacheBackPlate, CacheManager.StackExchange.Redis">
<handle name="default" ref="runtimeHandle" />
<handle name="redis1" ref="redisHandle" expirationMode="None" isBackPlateSource="true" />
</cache>
</managers>
<cacheHandles>
<handleDef id="runtimeHandle" type="CacheManager.SystemRuntimeCaching.MemoryCacheHandle`1, CacheManager.SystemRuntimeCaching" defaultExpirationMode="Sliding" defaultTimeout="5m"/>
<handleDef id="redisHandle" type="CacheManager.Redis.RedisCacheHandle`1, CacheManager.StackExchange.Redis" defaultExpirationMode="Sliding" defaultTimeout="5m" />
</cacheHandles>
</cacheManager>
but after running two instances of application I see that variable Configuration.BackPlateType is set to null and backPlate doesn't work.
at the same time with following configuration in code it works perfectly.
ICacheManager<object> cache = CacheFactory.Build<object>("myCache", settings =>
{
settings
.WithSystemRuntimeCacheHandle("inProcessCache")
.And
.WithRedisConfiguration("redis", config =>
{
config.WithAllowAdmin()
.WithDatabase(0)
.WithEndpoint("localhost", 6379);
})
.WithMaxRetries(1000)
.WithRetryTimeout(100)
.WithRedisBackPlate("redis")
.WithRedisCacheHandle("redis", true);
});
Looks like a bug in config file parsing.