A comprehensive resilience and caching ecosystem for HttpClient with built-in retry policies, circuit breakers, and intelligent response caching. Based on Polly but with zero configuration required.
Not sure which approach to use? β Read our Choosing Guide
Your Use Case | Recommended Approach | Documentation |
---|---|---|
Single API with 1-2 entity types | Generic Caching | Getting Started |
REST API with 5+ entity types | Universal Handlers | Choosing Guide |
Need HttpClient substitution | IHttpClientAdapter | Substitution Guide |
Custom serialization/error handling | Custom Response Handler | Advanced Usage |
Package | Purpose | Version |
---|---|---|
Reliable.HttpClient | Core resilience (retry + circuit breaker) | dotnet add package Reliable.HttpClient |
Reliable.HttpClient.Caching | HTTP response caching extension | dotnet add package Reliable.HttpClient.Caching |
- Zero Configuration: Works out of the box with sensible defaults
- Complete Solution: Resilience + Caching in one ecosystem
- Lightweight: Minimal overhead, maximum reliability
- Production Ready: Used by companies in production environments
- Easy Integration: One line of code to add resilience, two lines for caching
- Secure: SHA256-based cache keys prevent collisions and attacks
- Flexible: Use core resilience alone or add caching as needed
dotnet add package Reliable.HttpClient
// Add to your Program.cs
builder.Services.AddHttpClient<ApiClient>(c => c.BaseAddress = new Uri("https://api.example.com"))
.AddResilience(); // That's it! β¨
// Use anywhere
public class ApiClient(HttpClient client)
{
public async Task<Data> GetDataAsync() =>
await client.GetFromJsonAsync<Data>("/endpoint");
}
// Need custom headers? Use the adapter pattern:
public class AuthApiClient(IHttpClientAdapter client, ITokenProvider tokens)
{
public async Task<Data> GetDataAsync(string userId)
{
var headers = new Dictionary<string, string>
{
{ "Authorization", $"Bearer {await tokens.GetTokenAsync(userId)}" }
};
return await client.GetAsync<Data>("/endpoint", headers);
}
}
You now have: Automatic retries + Circuit breaker + Smart error handling
π Need details? See Getting Started Guide for step-by-step setup π Building REST APIs? Check Universal Response Handlers π Need substitution patterns? See HttpClient Substitution Guide
- Zero Configuration β Works out of the box
- Resilience β Retry + Circuit breaker
- Caching β Intelligent HTTP response caching
- Custom Headers β Default and per-request header support
- OAuth/Auth Support β Dynamic token handling per request
- Universal Handlers β Non-generic response handling for REST APIs
- HttpClient Substitution β Switch between cached/non-cached implementations
- Production Ready β Used by companies in production
π Full Feature List: Documentation
// Custom settings
.AddResilience(options => options.Retry.MaxRetries = 5);
// Ready-made presets
.AddResilience(HttpClientPresets.SlowExternalApi());
π Full Configuration: Configuration Guide
Organizations using Reliable.HttpClient in production:
- Getting Started Guide - Step-by-step setup
- Choosing Your Approach - Which pattern fits your use case
- Common Scenarios - Real-world examples
- Configuration Reference - Complete options
- Advanced Usage - Advanced patterns
- HTTP Caching Guide - Caching documentation
Contributions are welcome! Please read our Contributing Guide for details.
This project is licensed under the MIT License - see the LICENSE file for details.