interface RateLimiterInterface (View source)

Limits repeated events by opaque caller-defined keys without exposing storage details.

Methods

status(string $key, string $scope, RateLimitPolicy $policy)

Returns the current bucket state without recording an attempt.

hit(string $key, string $scope, RateLimitPolicy $policy)

Atomically records one attempt and returns the resulting bucket state.

void
clear(string $key)

Removes the bucket associated with one opaque key.

void

Details

status

RateLimitResult status(string $key, string $scope, RateLimitPolicy $policy)

Returns the current bucket state without recording an attempt.

Scope is validated diagnostic metadata only; it does not affect bucket identity.

Parameters

string $key
string $scope
RateLimitPolicy $policy

Return Value

RateLimitResult

hit

RateLimitResult hit(string $key, string $scope, RateLimitPolicy $policy)

Atomically records one attempt and returns the resulting bucket state.

Scope records safe diagnostic metadata without affecting bucket identity.

Parameters

string $key
string $scope
RateLimitPolicy $policy

Return Value

RateLimitResult

clear

void clear(string $key)

Removes the bucket associated with one opaque key.

Parameters

string $key

Return Value

void