RateLimitPartition.GetTokenBucketLimiter<TKey> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.