System.Threading.RateLimiting.PartitionedRateLimiter<TResource>
Represents a limiter type that users interact with to determine if an operation can proceed given a specific TResource.
protected PartitionedRateLimiter()
public ValueTask<RateLimitLease> AcquireAsync(TResource resource, int permitCount = 1, CancellationToken cancellationToken = default)
Wait until the requested permits are available or permits can no longer be acquired.
protected abstract ValueTask<RateLimitLease> AcquireAsyncCore(TResource resource, int permitCount, CancellationToken cancellationToken)
Method that PartitionedRateLimiter<T> implementations implement for AcquireAsync.
Fast synchronous attempt to acquire permits.
Method that PartitionedRateLimiter<T> implementations implement for AttemptAcquire.
Dispose method for implementations to write.
Disposes the RateLimiter. This completes any queued acquires with a failed lease.
Disposes the RateLimiter asynchronously.
DisposeAsync method for implementations to write.
Gets a snapshot of the statistics for the resource if available.
public PartitionedRateLimiter<TOuter> WithTranslatedKey<TOuter>(Func<TOuter, TResource> keyAdapter, bool leaveOpen)
Translates PartitionedRateLimiter<TOuter> into the current PartitionedRateLimiter<T>
using the keyAdapter to translate TOuter to TResource.