RateLimitPartition.Get<TKey>(TKey, Func<TKey,RateLimiter>) Method

Definition

Defines a partition with the given rate limiter factory.

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

Type Parameters

TKey

The type to distinguish partitions with.

Parameters

partitionKey
TKey

The specific key for this partition. This will be used to check for an existing cached limiter before calling the factory.

factory
Func<TKey,RateLimiter>

The function called when a rate limiter for the given partitionKey is needed. This should be a new instance of a rate limiter every time it is called.

Returns

Remarks

The factory should return a new instance of a rate limiter every time it is called.

Applies to