RateLimitedRequestAttemptUtil<T> class
abstract
Utility class for tracking and rate limiting request attempts.
This class provides a reusable mechanism for rate limiting requests based on:
- Attempt count: Limits the total number of attempts
- Timeframe: Limits attempts within a rolling window
Both mechanisms can be used together, but at least one must be provided.
The T type parameter represents the type of the nonce.
- Implementers
Constructors
-
RateLimitedRequestAttemptUtil(RateLimitedRequestAttemptConfig<
T> config) - Creates a new RateLimitedRequestAttemptUtil instance.
Properties
-
config
→ RateLimitedRequestAttemptConfig<
T> -
The configuration for the rate limiting.
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 T nonce}) → Future< int> - Counts the number of attempts for the given nonce.
-
deleteAttempts(
Session session, {required T nonce, Duration? olderThan}) → Future< void> - Deletes all attempts that match the given filters.
-
hasTooManyAttempts(
Session session, {required T nonce, Map< String, String> ? extraData}) → Future<bool> - Records and attempts and checks if there have been too many attempts for the given nonce.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
recordAttempt(
Session session, {required T nonce, Map< String, String> ? extraData}) → Future<void> - Records an attempt for the given nonce.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited