LiteRetry 0.0.3
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package LiteRetry --version 0.0.3
NuGet\Install-Package LiteRetry -Version 0.0.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LiteRetry" Version="0.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LiteRetry" Version="0.0.3" />
<PackageReference Include="LiteRetry" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LiteRetry --version 0.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: LiteRetry, 0.0.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=LiteRetry&version=0.0.3
#tool nuget:?package=LiteRetry&version=0.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
LiteRetry.Core
LiteRetry.Core is a lightweight, fluent and flexible retry utility for .NET.
It helps developers add retry logic to any asynchronous or synchronous operation with minimal setup and maximum control.
✨ Features
- ✅ Simple and fluent API
- 🔁 Automatic retries with configurable limits
- ⏱️ Support for fixed or exponential backoff
- 🎯 Conditional retry filtering
- 📣 Hook for
onRetry
callback - ❌ Cancellation support via
CancellationToken
- 📦
RetryResult<T>
with metadata (attempts, elapsed time) - 🧠
RetryContext
for diagnostics - ❗ Custom
RetryFailedException
📦 Installation
You can install via NuGet:
dotnet add package LiteRetry
Or via the NuGet Package Manager:
Install-Package LiteRetry
🚀 Quick Example
using LiteRetry.Core.Retry.Fluent;
var result = await RetryBuilder<string>
.Create()
.WithRetries(3)
.WithDelay(500)
.WithBackoff()
.Filter(ex => ex is TimeoutException)
.OnRetry(ctx =>
{
Console.WriteLine($"Retry {ctx.Attempt} after {ctx.Delay.TotalMilliseconds}ms");
return Task.CompletedTask;
})
.RunAsync(async () =>
{
// Your operation
return await GetDataFromRemote();
});
Console.WriteLine($"Result: {result.Value} in {result.Attempts} attempts");
🔧 Basic Usage
If you prefer a static API:
var result = await RetryExecutor.ExecuteAsync(
action: async () => await SomeOperation(),
options: new RetryOptions
{
Retries = 3,
DelayMilliseconds = 500,
Backoff = true,
ShouldRetry = ex => ex is HttpRequestException
}
);
🧱 API Components
RetryExecutor
– Static retry logic handlerRetryBuilder<T>
– Fluent builder for retry configurationRetryContext
– Info about the retry state per attemptRetryResult<T>
– Final result including metadataRetryFailedException
– Exception thrown after final failure
📄 License
This project is licensed under the MIT License.
🙌 Author
Created by Javier Angosto Barjollo
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.