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.
- 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>.
Applies to
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for