RateLimitClearEvent class final
Event published when all request counters for a given rate limit bucket or storage have been cleared.
This event is typically used in rate limit management systems to notify observers that a reset or clearing operation has occurred. Consumers of this event can use it for:
- Updating monitoring dashboards or metrics counters.
- Logging historical rate limit usage.
- Triggering downstream processes that depend on cleared limits.
Properties:
- limitName: Identifies the rate-limited bucket or resource.
- totalCount: The total number of requests that were tracked and cleared during this operation.
source: Typically the identifier of the entity (e.g., user ID, IP, API key) for which the limit was applied.timestamp: Optional timestamp indicating when the event occurred.
Example Usage:
final event = RateLimitClearEvent('user:123', 'apiRequests', 50);
print(event);
// Output: RateLimitClearEvent(limit: apiRequests, identifier: user:123, totalCount: 50)
Related Components:
- RateLimitEvent: Base class for all rate limit events.
- RateLimitAllowedEvent: Published when a request is allowed.
- RateLimitDeniedEvent: Published when a request is denied.
- RateLimitResetEvent: Published when a rate limit window resets.
- RateLimitManager: Manages multiple RateLimitStorage instances and emits events.
- Inheritance
-
- Object
- RateLimitEvent
- RateLimitClearEvent
Constructors
- RateLimitClearEvent(Object source, String limitName, int totalCount, [DateTime? timestamp])
-
Creates a new event indicating that a rate limit storage or bucket has been cleared.
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- limitName → String
-
The name of the rate-limited resource or bucket.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- totalCount → int
-
The total number of requests that were cleared from the rate limit storage.
final
Methods
-
equalizedProperties(
) → List< Object?> -
Mixin-style contract for value-based equality,
hashCode, andtoString.inherited -
getPackageName(
) → String -
Represents an abstraction for identifying the package that an object,
resource, or service belongs to.
inherited
-
getSource(
) → Object -
Returns the source of the event.
inherited
-
getTimestamp(
) → DateTime -
Returns the timestamp of the event.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
-
toStringOptions(
) → ToStringOptions -
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited