RateLimiter class abstract
Tracks attempts for opaque string keys scoped by domain and source.
Callers provide a stable string representation, for example requestId.uuid.
- Implementers
Constructors
- RateLimiter(RateLimiterConfig config)
- Creates a limiter with the given configuration.
Properties
- config → RateLimiterConfig
-
The namespace, limit, and optional rolling window.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
countAttempts(
Session session, {required String key, Transaction? transaction}) → Future< int> -
Counts attempts for
keywithin the configured window, or all time. -
deleteAttempts(
Session session, {String? key, Duration? olderThan, Transaction? transaction}) → Future< int> - Deletes attempts within this limiter's domain and source.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
tryRecordAttempt(
Session session, {required String key, Map< String, String> ? extraData}) → Future<bool> - Atomically admits and records an attempt if budget remains.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited