RateLimitService class

Evaluates compiled policies for incoming requests.

Matching policies are evaluated in list order. Every matching policy with a resolvable identity consumes its own allowance until one blocks the request; therefore a request can consume multiple policy quotas.

Constructors

RateLimitService(List<CompiledRateLimitPolicy> _policies, {RateLimitEventCallbacks? callbacks})
Creates a service for the supplied policies.

Properties

enabled → bool
Whether this service has at least one policy to evaluate.
no setter
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

attachCallbacks(RateLimitEventCallbacks? callbacks) → void
Replaces the callbacks used for subsequent evaluations.
check(RateLimitRequest request) → Future<RateLimitOutcome?>
Evaluates request and returns the first blocking outcome.
dispose() → Future<void>
Closes each distinct backend used by this service.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited