Share via


RateLimitPartition.GetSlidingWindowLimiter<TKey> Method

Definition

Defines a partition with a SlidingWindowRateLimiter with the given SlidingWindowRateLimiterOptions.

public static System.Threading.RateLimiting.RateLimitPartition<TKey> GetSlidingWindowLimiter<TKey> (TKey partitionKey, Func<TKey,System.Threading.RateLimiting.SlidingWindowRateLimiterOptions> factory);
static member GetSlidingWindowLimiter : 'Key * Func<'Key, System.Threading.RateLimiting.SlidingWindowRateLimiterOptions> -> System.Threading.RateLimiting.RateLimitPartition<'Key>
Public Shared Function GetSlidingWindowLimiter(Of TKey) (partitionKey As TKey, factory As Func(Of TKey, SlidingWindowRateLimiterOptions)) 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,SlidingWindowRateLimiterOptions>

The function called when a rate limiter for the given partitionKey is needed. This can return the same instance of SlidingWindowRateLimiterOptions 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