Share via


RateLimitPartition.GetFixedWindowLimiter<TKey> Method

Definition

Defines a partition with a FixedWindowRateLimiter with the given FixedWindowRateLimiterOptions.

public static System.Threading.RateLimiting.RateLimitPartition<TKey> GetFixedWindowLimiter<TKey> (TKey partitionKey, Func<TKey,System.Threading.RateLimiting.FixedWindowRateLimiterOptions> factory);
static member GetFixedWindowLimiter : 'Key * Func<'Key, System.Threading.RateLimiting.FixedWindowRateLimiterOptions> -> System.Threading.RateLimiting.RateLimitPartition<'Key>
Public Shared Function GetFixedWindowLimiter(Of TKey) (partitionKey As TKey, factory As Func(Of TKey, FixedWindowRateLimiterOptions)) As RateLimitPartition(Of TKey)

Type Parameters

TKey

The type to distinguish partitions with.

Parameters

partitionKey
TKey

The specific key for this partition.

factory
Func<TKey,FixedWindowRateLimiterOptions>

The function called when a rate limiter for the given partitionKey is needed. This can return the same instance of FixedWindowRateLimiterOptions across different calls.

Returns

Remarks

Set AutoReplenishment to false to save an allocation. This method will create a new options type and set AutoReplenishment to false otherwise.

Applies to