Share via


RateLimiter Class

Definition

Represents a limiter type that users interact with to determine if an operation can proceed.

public abstract class RateLimiter : IAsyncDisposable, IDisposable
type RateLimiter = class
    interface IAsyncDisposable
    interface IDisposable
Public MustInherit Class RateLimiter
Implements IAsyncDisposable, IDisposable
Inheritance
RateLimiter
Derived
Implements

Constructors

RateLimiter()

Properties

IdleDuration

Specifies how long the RateLimiter has had all permits available. Used by RateLimiter managers that may want to clean up unused RateLimiters.

Methods

AcquireAsync(Int32, CancellationToken)

Wait until the requested permits are available or permits can no longer be acquired.

AcquireAsyncCore(Int32, CancellationToken)

Method that RateLimiter implementations implement for AcquireAsync(Int32, CancellationToken).

AttemptAcquire(Int32)

Fast synchronous attempt to acquire permits.

AttemptAcquireCore(Int32)

Method that RateLimiter implementations implement for AttemptAcquire(Int32).

Dispose()

Disposes the RateLimiter. This completes any queued acquires with a failed lease.

Dispose(Boolean)

Dispose method for implementations to write.

DisposeAsync()

Disposes the RateLimiter asynchronously.

DisposeAsyncCore()

DisposeAsync method for implementations to write.

GetStatistics()

Gets a snapshot of the RateLimiter statistics if available.

Applies to