PartitionedRateLimiter<TResource>.WithTranslatedKey<TOuter> 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.
Translates PartitionedRateLimiter<TOuter> into the current PartitionedRateLimiter<TResource>
using the keyAdapter to translate TOuter to TResource.
public System.Threading.RateLimiting.PartitionedRateLimiter<TOuter> WithTranslatedKey<TOuter>(Func<TOuter,TResource> keyAdapter, bool leaveOpen);
member this.WithTranslatedKey : Func<'Outer, 'Resource> * bool -> System.Threading.RateLimiting.PartitionedRateLimiter<'Outer>
Public Function WithTranslatedKey(Of TOuter) (keyAdapter As Func(Of TOuter, TResource), leaveOpen As Boolean) As PartitionedRateLimiter(Of TOuter)
Type Parameters
- TOuter
The type to translate into TResource.
Parameters
- keyAdapter
- Func<TOuter,TResource>
The function to be called every time a TOuter is passed to
PartitionedRateLimiter<TOuter>.Acquire(TOuter, int) or PartitionedRateLimiter<TOuter>.WaitAsync(TOuter, int, CancellationToken).
keyAdapter should be implemented in a thread-safe way.</remarks>
- leaveOpen
- Boolean
Specifies whether the returned PartitionedRateLimiter<TResource> will dispose the wrapped PartitionedRateLimiter<TResource>.
Returns
A new PartitionedRateLimiter<TOuter> that translates TOuter
to TResource and calls the inner PartitionedRateLimiter<TResource>.