NCache.OSS.RateLimiting 5.3.6.1

dotnet add package NCache.OSS.RateLimiting --version 5.3.6.1
                    
NuGet\Install-Package NCache.OSS.RateLimiting -Version 5.3.6.1
                    
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="NCache.OSS.RateLimiting" Version="5.3.6.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NCache.OSS.RateLimiting" Version="5.3.6.1" />
                    
Directory.Packages.props
<PackageReference Include="NCache.OSS.RateLimiting" />
                    
Project file
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 NCache.OSS.RateLimiting --version 5.3.6.1
                    
#r "nuget: NCache.OSS.RateLimiting, 5.3.6.1"
                    
#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.
#:package NCache.OSS.RateLimiting@5.3.6.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NCache.OSS.RateLimiting&version=5.3.6.1
                    
Install as a Cake Addin
#tool nuget:?package=NCache.OSS.RateLimiting&version=5.3.6.1
                    
Install as a Cake Tool

NCache.OSS.RateLimiting

An NCache implementation of the RateLimiting API, providing concurrency, fixed window, sliding window, and token bucket rate limiters backed by an NCache cluster.

This package plugs into the System.Threading.RateLimiting abstractions (RateLimiter, RateLimitPartition, PartitionedRateLimiter) as well as ASP.NET Core's Microsoft.AspNetCore.RateLimiting middleware, so it can be used as a drop-in rate limiting provider anywhere those types are expected.

Features

  • Concurrency Limiter — bounds the number of concurrent in-flight requests, queuing excess requests in strict, cross-node FIFO order and rejecting once the queue is full.
  • Fixed Window Limiter — allows up to N requests per fixed time window, resetting the count when the window elapses.
  • Sliding Window Limiter — tracks individual request timestamps and continuously slides the evaluation window forward, avoiding the burst-at-boundary behavior of fixed windows.
  • Token Bucket Limiter — a bucket of tokens that refills at a steady rate, allowing short bursts up to the bucket's capacity while enforcing a long-run average rate.
  • State keys are auto-expired in NCache as a safety net against processes that crash while holding a lease.

Installation

dotnet add package NCache.OSS.RateLimiting

Requirements

  • .NET 8.0 or higher
  • An NCache client connection (Alachisoft.NCache.Client) to a running NCache cache/cluster
  • References Alachisoft.NCache.Opensource.SDK and System.Threading.RateLimiting

Usage

Setting up rate limiting

using Microsoft.AspNetCore.RateLimiting;
using NCache.OSS.RateLimiting;

builder.Services.AddRateLimiter(options =>
{
    options.AddNCacheConcurrencyLimiter("my-policy", limiter =>
    {
        limiter.PermitLimit = 10;
        limiter.QueueLimit = 5;
        limiter.CacheName = "myCache";
    });
});

AddRateLimiter accepts any combination of the four AddNCacheXxxLimiter policy registrations below, so it can configure any of the four primitives shown here.

Concurrency Limiter

options.AddNCacheConcurrencyLimiter("my-resource-name", limiter =>
{
    limiter.PermitLimit = 10;
    limiter.QueueLimit = 5;
    limiter.CacheName = "myCache";
});
// or: var concurrencyLimiter = new ConcurrencyRateLimiter<string>("my-resource-name", options);

Fixed Window Limiter

options.AddNCacheFixedWindowLimiter("my-resource-name", limiter =>
{
    limiter.PermitLimit = 100;
    limiter.Window = TimeSpan.FromMinutes(1);
    limiter.CacheName = "myCache";
});
// or: var fixedWindowLimiter = new FixedWindowRateLimiter<string>("my-resource-name", options);

Sliding Window Limiter

options.AddNCacheSlidingWindowLimiter("my-resource-name", limiter =>
{
    limiter.PermitLimit = 100;
    limiter.Window = TimeSpan.FromMinutes(1);
    limiter.CacheName = "myCache";
});
// or: var slidingWindowLimiter = new NCacheSlidingWindowRateLimiter<string>("my-resource-name", options);

Token Bucket Limiter

options.AddNCacheTokenBucketLimiter("my-resource-name", limiter =>
{
    limiter.TokenLimit = 100;
    limiter.TokensPerPeriod = 10;
    limiter.ReplenishmentPeriod = TimeSpan.FromSeconds(10);
    limiter.CacheName = "myCache";
});
// or: var tokenBucketLimiter = new TokenBucketRateLimiting<string>("my-resource-name", options);

Important

If NCache is not installed on the machine, you must ensure that Client. ncconf and Config.ncconf contain all required configuration information.

Documentation

A guide to NCache API can be found at:

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.  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. 
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
5.3.6.1 73 8/21/2026