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.
