Repository navigation
Caching.StackExchangeRedis: add "force reconnect" pattern - #45261
Conversation
2. avoid thread-race problems by having Connect[Async] *return* the cache, rather than relying on field 3. avoid thread-race problems by only using a single ref field (cache), rather than cache+muxer; access indirectly 4. use more efficient key-prefix path via RedisKey.Append 5. use more efficient hash-fetch by pre-storing the hash-key arrays (removes need for RedisExtensions.cs) 6. general code tidy; null-handling, defaults, etc (no semantic change)
|
/cc @philon-msft re eyeball of core reconnect loop (absorbed from https://github.com/Azure-Samples/azure-cache-redis-samples/blob/main/quickstart/dotnet-core/RedisConnection.cs#L89) |
|
PR nits resolved; good feedback and discussion, thanks |
|
When/How can I get this feature? |
Co-authored-by: Stephen Halter <[email protected]>
Co-authored-by: Stephen Halter <[email protected]>
|
@BrennanConroy should we add this to the SignalR backplane as well? Also @ReubenBond should this be part of the redis clustering provider for orleans? |
|
For the other projects: if using the StackExchange.Redis client, we'd recommend upgrading to latest (2.6.x) and see if you actually hit any issues. If so, please ping ASAP and let's fix those in the core library. This entire feature shouldn't be needed any more - if there are some scenarios still tossing the connection (and anything buffered, which the base library would send upon connecting up to the timeout), let's figure that out and improve for all. The workaround is inherently a bit destructive compared to the base library, and should only be a last resort. For context: most of the need for something like this was before working with the Azure Redis cache folks to understand scenarios previously unknown and handling everything we're aware of today. TL;DR: it's mostly outdated advice, and the defaults should be doing good things today on latest library bits. |
So why are we doing this PR then? |
- fixup interface delta in test harness - make an analyzer happy about a redundant lambda
Co-authored-by: David Fowler <[email protected]>
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/azp run |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
Caching.StackExchangeRedis: add "force reconnect" pattern
Adds the "force reconnect" pattern as described in azure cache best practices, with an implementation modified to retain the pre-existing custom connect logic
Tests forced locally (they're
[Skip]in the source), and observed withredis-cli monitorto validate that key-prefix still valid.Description
UseForceReconnectoption (defaults tofalse)Fixes #39082