Skip to content

defaultDatabase number specified in redis connection string not honoured #175

@chai-deshpande

Description

@chai-deshpande

I am trying to use the redis cache using the connection string approach and the defaultDatabase that I have specified in the connection string is not getting picked up when caching the data in redis.

My configuration looks like this:

  <cacheManager xmlns="http://cachemanager.michaco.net/schemas/CacheManagerCfg.xsd">
    <managers>
      <cache name="distributed-data-cache" enableStatistics="true" backplaneName="redis.cache" backplaneType="CacheManager.Redis.RedisCacheBackplane, CacheManager.StackExchange.Redis" serializerType="CacheManager.Serialization.Json.JsonCacheSerializer, CacheManager.Serialization.Json">
        <handle name="default" ref="inmemoryHandle" />
        <handle name="redis.cache" ref="redisHandle" isBackplaneSource="true" />
      </cache>
      <cache name="inmemory-data-cache" enableStatistics="true" serializerType="CacheManager.Serialization.Json.JsonCacheSerializer, CacheManager.Serialization.Json">
        <handle name="default" ref="inmemoryHandle" />
      </cache>
    </managers>
    <cacheHandles>
      <handleDef id="inmemoryHandle" type="CacheManager.SystemRuntimeCaching.MemoryCacheHandle`1, CacheManager.SystemRuntimeCaching" defaultExpirationMode="Sliding" defaultTimeout="2m" />
      <handleDef id="redisHandle" type="CacheManager.Redis.RedisCacheHandle`1, CacheManager.StackExchange.Redis" defaultExpirationMode="Sliding" defaultTimeout="5m" />
    </cacheHandles>
  </cacheManager>

Connection string is specified like this:

  <connectionStrings>
    <add name="redis.cache" connectionString="127.0.0.1:6379,allowAdmin=False,connectTimeout=500,defaultDatabase=3,ssl=False,abortConnect=False,connectRetry=3" />
  </connectionStrings>

With this configuration - I expect the data to be written to database 3 in redis. However, it is getting written to database 0.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions