FflagClient 0.3.6

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

// Install FflagClient as a Cake Tool
#tool nuget:?package=FflagClient&version=0.3.6                

This is a client-side C# client for FFlag. It evaluates requests right in the process on a client instead of making an HTTP call to FFlag every time a flag is requested. The benefit of it is a huge unmatched performance ( see benchmark)

How to use

  1. Install and register the package
dotnet add package FflagClient
var fflagUri = new Uri("http://localhost:9090");
builder.Services.AddFflagClient(fflagUri, options =>
{
    options.UpdateIntervalInSeconds = 20;       // default is 60 seconds
    options.WatchedGroups.Add("this-app-name"); // at least one watched group is required
});
  1. Inject IFlagEvaluator into a constructor or a handler
IFlagEvaluator flagEvaluator
  1. Call the client
flagEvaluator.GetBool(flagName); // just a flag name
flagEvaluator.GetBool(flagName, userId); // flag name and entityId
flagEvaluator.GetBool(flagName, userId, Parameters.Add(countryCode).Add(age)); // with parameters

// other methods are available. Call these depending on the type of a flag
flagEvaluator.GetDouble(...)
flagEvaluator.GetLong(...)
flagEvaluator.GetString(...)

How it works

The client has a background job that queries flag configurations from FFlag every UpdateIntervalInSeconds. The server returns flags updated since the last time. The configuration is stored in memory. FFlag can have thousands of flags defined in it, but it's rare that an app needs all of them. Usually, only a subset of flags is queried from an app and the rest of the flags are meant for other apps.

To specify which flag configuration to keep in memory, provide a list of groups to which the flags should belong. A group is just a string that denotes a set of flags and is defined in FFlag UI. A flag can belong to multiple groups. A flag must have a group to be used in FflagClient.

A group can be a name of an app or a name of a UX flow if the flow goes through multiple services and is queried by all of them.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
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
0.3.6 429 10/18/2024
0.3.5 153 10/18/2024
0.3.4 64 10/7/2024
0.3.3 62 10/7/2024
0.3.2 77 10/7/2024
0.3.1 71 10/6/2024
0.3.0 75 10/6/2024
0.2.4 71 10/5/2024
0.2.3 69 10/5/2024
0.2.2 66 10/5/2024
0.2.1 68 10/5/2024
0.2.0 76 10/4/2024