dotnet/aspnetcore

[StackExchange.Redis] Add DefaultReadCommandFlag into RedisCacheOptions for read operations

开放

#28,375 创建于 2019年5月14日

 (6 条评论) (2 个反应) (0 位负责人)C# (10,653 个派生)batch import
area-middlewareenhancementfeature-cachinghelp wanted

仓库指标

星标
 (37,933 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

Is your feature request related to a problem? Please describe.

I am trying to hookup RedisCache to multiple nodes in AWS ElastiCache. I have 1 primary node and n replication nodes. Currently when configuring RedisCacheOptions.ConfigurationOptions with multiple Endpoints, RedisCache doesn't read from the replication nodes.

Describe the solution you'd like

In StackExchange.Redis there is a CommandFlags enum that will allow us to PreferSlave. I would like to add another property along the lines of DefaultReadCommandFlag to RedisCacheOptions for read commands. This will allow us to specify PreferSlave and distribute load across the replication nodes.

Command Flags: https://github.com/StackExchange/StackExchange.Redis/blob/c72ffa8413572262b8eb9f8f4e0c5da07f856359/src/StackExchange.Redis/Enums/CommandFlags.cs#L27-L47

贡献者指南