Share via


RateLimitPartition.GetTokenBucketLimiter<TKey> Method

Definition

Defines a partition with a TokenBucketRateLimiter with the given TokenBucketRateLimiterOptions.

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

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