Skip to content

Add C# examples to circuit breaker documentation page #273

Description

@currantw

Description

The circuit breaker documentation page at https://glide.valkey.io/how-to/connections/circuit-breaker/ currently shows "The circuit breaker is not yet available in the C# client" under the C# tab for both the Configuration and Handling Rejections sections.

Circuit breaker support is being added to the C# client in valkey-io/valkey-glide-csharp#474. Once that PR is merged, the C# tab should be updated with:

  • Configuration example using CircuitBreakerConfig with fluent WithXxx() methods
  • Exception handling example catching CircuitBreakerException

C# API (for docs authors)

// Configuration
var cb = new CircuitBreakerConfig()
    .WithWindowSize(TimeSpan.FromSeconds(15))
    .WithFailureRateThreshold(0.6)
    .WithCountTimeouts(true);

var config = new ConnectionConfiguration.StandaloneClientConfigurationBuilder()
    .WithAddress("localhost", 6379)
    .WithCircuitBreaker(cb)
    .Build();

var client = await GlideClient.CreateClient(config);
// Handling rejections
try
{
    await client.SetAsync("key", "value");
}
catch (Errors.CircuitBreakerException)
{
    // Circuit breaker is open — requests are being rejected
}

Context

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions