Skip to content

Need ConnectionRestored Event subscribe in the CacheManager ,to identify connection is up after it went down. #146

@vijay8059

Description

@vijay8059

Need ConnectionRestored event in the CacheManager that available in the StackExchange.Redis client .
so be used as a part of WithRedisConfiguration so to identify connection is up after it went down

    var cacheConfig = ConfigurationBuilder.BuildConfiguration(settings =>
        {
            settings
            .WithDictionaryHandle("inProcessCacheA1").WithExpiration(ExpirationMode.Sliding, TimeSpan.FromSeconds(30))
            .And
            .WithRedisConfiguration("redisCacheA1", config =>
            {
                config.WithAllowAdmin()
                    .WithDatabase(0).WithConnectionTimeout(8000)
                    .WithEndpoint(server, 6379);
            })
            .WithMaxRetries(1000)
            .WithRetryTimeout(100)
            .WithRedisBackplane("redisCacheA1", "redisCacheA1")
            .WithRedisCacheHandle("redisCacheA1", true); //.WithExpiration(ExpirationMode.Absolute, TimeSpan.FromSeconds(40))//.
            
        });

And also can remove the redis configuration on fly. Suppose if i get an exception i want to remove the redis configuration and only use in memory cache. After redis is up then i add the redis configuration back. I am seeing some issue
cacheConfig.CacheHandleConfigurations.Remove(redisConfiguration);
But i am see exception as ""At least one cache handle must be marked as the backplane source if a backplane is defined via configuration."" i got it as put in the configuration as

 .WithRedisBackplane("redisCacheA1", "redisCacheA1")
            .WithRedisCacheHandle("redisCacheA1", true);

i have put the backplane=false in the redisconfiguration but how to remove the back plane from cache config.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions