Carom 1.7.0
See the version list below for details.
dotnet add package Carom --version 1.7.0
NuGet\Install-Package Carom -Version 1.7.0
<PackageReference Include="Carom" Version="1.7.0" />
<PackageVersion Include="Carom" Version="1.7.0" />
<PackageReference Include="Carom" />
paket add Carom --version 1.7.0
#r "nuget: Carom, 1.7.0"
#:package Carom@1.7.0
#addin nuget:?package=Carom&version=1.7.0
#tool nuget:?package=Carom&version=1.7.0
Carom 🎱
A lean, fast, and safe resilience library for .NET
Carom is a zero-dependency resilience library that enforces best practices by default. Named after the billiards shot where the ball bounces before reaching its target, Carom helps your code gracefully handle failures.
Runs on .NET 10 and .NET 8. The core packages target netstandard2.0, so .NET Framework and older .NET are supported too; the ASP.NET Core, EF Core and OpenTelemetry packages target net8.0;net10.0. Tests run on both runtimes in CI.
🎯 Why Carom?
- Zero Dependencies (core packages)
- Minimal Allocations (<100 bytes on hot path)
- Safe by Default (mandatory decorrelated jitter)
- Tiny Footprint (13KB core, 20KB extensions)
- Fully Composable (all patterns work together)
📦 Packages
| Package | Version | Size | Purpose |
|---|---|---|---|
| Carom | v1.3.0 | 13KB | Core retry + timeout |
| Carom.Extensions | v1.4.0 | 20KB | Circuit Breaker, Fallback, Bulkhead, Rate Limiting |
| Carom.Http | v1.0.0 | 11KB | HTTP integration |
| Carom.AspNetCore | v1.0.0 | 10KB | ASP.NET Core health checks |
| Carom.EntityFramework | v1.0.0 | 10KB | EF Core retry |
| Carom.Telemetry.OpenTelemetry | v1.0.0 | 9KB | OpenTelemetry metrics |
🚀 Quick Start
Installation
dotnet add package Carom
dotnet add package Carom.Extensions
Basic Usage
using Carom;
// Simple retry with exponential backoff
var result = await Carom.ShotAsync(() => api.CallAsync(), retries: 3);
// With timeout
var bounce = Bounce.Times(5).WithTimeout(TimeSpan.FromSeconds(30));
var data = await Carom.ShotAsync(() => apiClient.FetchAsync(), bounce);
Circuit Breaker
using Carom.Extensions;
var cushion = Cushion.ForService("payment-api")
.OpenAfter(failures: 5, within: 10)
.HalfOpenAfter(TimeSpan.FromSeconds(30));
var payment = await CaromCushionExtensions.ShotAsync(
() => paymentApi.Charge(),
cushion);
Fallback
var config = await new Func<Task<AppConfig>>(() => configService.LoadAsync())
.PocketAsync(AppConfig.Default);
Bulkhead
var dbCompartment = Compartment.ForResource("database")
.WithMaxConcurrency(10)
.Build();
var query = await CaromCompartmentExtensions.ShotAsync(
() => db.QueryAsync(sql),
dbCompartment);
Rate Limiting
var apiThrottle = Throttle.ForService("external-api")
.WithRate(100, TimeSpan.FromSeconds(1))
.WithBurst(20)
.Build();
var apiResult = await CaromThrottleExtensions.ShotAsync(
() => apiClient.CallAsync(),
apiThrottle);
🎓 Patterns
| Pattern | Class | Purpose |
|---|---|---|
| Retry | Carom |
Exponential backoff with jitter |
| Timeout | Bounce.WithTimeout() |
Operation timeout |
| Circuit Breaker | Cushion |
Prevent cascade failures |
| Fallback | Pocket/PocketAsync |
Graceful degradation |
| Bulkhead | Compartment |
Concurrency control |
| Rate Limiting | Throttle |
Token bucket algorithm |
�� Documentation
🤝 Contributing
Contributions welcome! Please read CONTRIBUTING.md first.
📄 License
MPL-2.0 - see LICENSE for details.
🙏 Acknowledgments
Built with the Baryo.Dev philosophy: zero dependencies, minimal allocations, safe by default.
Made with ❤️ by Baryo.Dev
📊 Performance
Carom is significantly faster than Polly v8:
- 175,000x faster startup (0.02ns vs 3,857ns)
- 15x faster hot path (10.9ns vs 167.8ns)
- 4.8x faster async operations (45ns vs 216ns)
See detailed benchmarks for complete analysis.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages (36)
Showing the top 5 NuGet packages that depend on Carom:
| Package | Downloads |
|---|---|
|
BarakoCMS
Headless CMS for .NET 10 on FastEndpoints and Marten over PostgreSQL: content types defined at runtime, event-sourced content, role and capability access control with field sensitivity, multi-tenancy, a public delivery API, blueprints, collection syncs and push, and workflows with 7 built-in actions. Optional modules ship as separate packages. |
|
|
Carom.Extensions
Advanced resilience patterns for Carom: Circuit Breaker, Fallback, Bulkhead, and Rate Limiting. Zero external dependencies. Lock-free implementations for maximum performance. Extends Carom core with production-grade patterns. |
|
|
BarakoCMS.ExternalAuth
External / social sign-in module for barakoCMS: "Continue with Facebook / Google / LinkedIn / GitHub" via OAuth, matched to a global user by verified email, plus any OpenID Connect provider configured by issuer URL (Apple included) and an id token grant for native apps, issuing the same tenant-scoped, device-bound token as the built-in flows. Captures profile details (photo, birthday, location) per provider. |
|
|
BarakoCMS.Files
Optional file-attachment module for barakoCMS: upload and retrieve files (receipts, photos, documents) stored in Postgres via Marten. |
|
|
BarakoCMS.Portability
Content portability for barakoCMS: export content-type definitions and their content data as a JSON bundle, and import a bundle into another instance (upsert types by name, recreate content via events). For backup, migration, seeding, and sharing content-type templates. |
GitHub repositories
This package is not used by any popular GitHub repositories.