PartitionedRateLimiter.Create<TResource,TPartitionKey> 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.
Method used to create a default implementation of PartitionedRateLimiter<TResource>.
public static System.Threading.RateLimiting.PartitionedRateLimiter<TResource> Create<TResource,TPartitionKey> (Func<TResource,System.Threading.RateLimiting.RateLimitPartition<TPartitionKey>> partitioner, System.Collections.Generic.IEqualityComparer<TPartitionKey>? equalityComparer = default);
static member Create : Func<'Resource, System.Threading.RateLimiting.RateLimitPartition<'PartitionKey>> * System.Collections.Generic.IEqualityComparer<'PartitionKey> -> System.Threading.RateLimiting.PartitionedRateLimiter<'Resource>
Public Shared Function Create(Of TResource, TPartitionKey) (partitioner As Func(Of TResource, RateLimitPartition(Of TPartitionKey)), Optional equalityComparer As IEqualityComparer(Of TPartitionKey) = Nothing) As PartitionedRateLimiter(Of TResource)
Type Parameters
- TResource
The resource type that is being rate limited.
- TPartitionKey
The type to distinguish partitions with.
Parameters
- partitioner
- Func<TResource,RateLimitPartition<TPartitionKey>>
Method called every time an Acquire or WaitAsync call is made to figure out what rate limiter to apply to the request. If the PartitionKey matches a cached entry then the rate limiter previously used for that key is used. Otherwise, the factory is called to get a new rate limiter.
- equalityComparer
- IEqualityComparer<TPartitionKey>
Optional IEqualityComparer<T> to customize the comparison logic for TPartitionKey
.