NFRInvoke 2.0.0-prerelease-pending-system-runtime-caching

This is a prerelease version of NFRInvoke.
dotnet add package NFRInvoke --version 2.0.0-prerelease-pending-system-runtime-caching
NuGet\Install-Package NFRInvoke -Version 2.0.0-prerelease-pending-system-runtime-caching
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="NFRInvoke" Version="2.0.0-prerelease-pending-system-runtime-caching" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NFRInvoke --version 2.0.0-prerelease-pending-system-runtime-caching
#r "nuget: NFRInvoke, 2.0.0-prerelease-pending-system-runtime-caching"
#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.
// Install NFRInvoke as a Cake Addin
#addin nuget:?package=NFRInvoke&version=2.0.0-prerelease-pending-system-runtime-caching&prerelease

// Install NFRInvoke as a Cake Tool
#tool nuget:?package=NFRInvoke&version=2.0.0-prerelease-pending-system-runtime-caching&prerelease

NFRInvoke : a simple pattern for function-call NFRs : retry, circuit-breaker, caching, timing, logging

NFRInvoke provides a simple pattern for addressing software quality requirements, or NFRS, or cross-cutting concerns, around distributed calls. Use it in where you can't or won't use MSIL rewrite techniques.

Currently includes these InvokeWrappers:

  • CircuitBreaker
  • CallTimer
  • Cacher
  • Retry

Examples

var cacher = new Cacher(TimeSpan.FromSeconds(99));
var r1=cacher.Call(ExpensiveMethod);
var r2=cacher.Call(ExpensiveMethod);

var breaker= new CircuitBreaker(""Test1"",1,TimeSpan.FromSeconds(1));
var r3=breaker.Call(FlakyMethod1, p1,p2); 
var r4=breaker.Call(FlakyMethod2, p1,p2,p3);

var r5= new Retry(timeout, maxRetries: 3).Do(FlakyMethod3, 1)
var backoffRetry= new Retry(timeout, Retry.ExponentialBackOff(TimeSpan.FromMilliseconds(10)));
backoffRetry.Call(ContestedMethod);

var callTimes= new List<TimeSpan>();
var callTimer = new CallTimer(ts=> callTimes.Add(ts));
callTimer.Call(SleepAndReturn, 100);
callTimer.Call(SleepAndReturn,1000);
callTimes.First().ShouldBeLessThan( callTimes.Skip(1).First() );

Most InvokeWrapper constructors take optional callback parameters to assist in logging, e.g.:

CircuitBreaker(string circuitName, int? errorsBeforeBreaking = null, TimeSpan? breakForHowLong = null, 
        Type[] exceptionsToThrowNotBreak = null, 
        Type[] exceptionsToBreak = null, 
        Action<string> onBeforeInvoke=null, 
        Action<Exception> onExceptionWasCaught = null, 
        Action<Exception> onExceptionWillBeThrown = null,
        Action<string> onDroppedCallWhileCircuitBroken = null)

Release 2.0.0.0 netstandard20 Relies on package System.Runtime.Caching which is still in pre-release.

Product 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. 
.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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0-prerelease-pending-sy... 765 3/5/2018