RateLimiter
class RateLimiter (View source)
Methods
void
bool
tooManyAttempts(
string $key,
int $maxAttempts,
int $decayMinutes = 1)
Determine if the given key has been "accessed" too many times.
int
hit(
string $key,
int $decayMinutes = 1)
Increment the counter for a given key for a given decay time.
mixed
attempts(
string $key)
Get the number of attempts for the given key.
mixed
resetAttempts(
string $key)
Reset the number of attempts for the given key.
int
retriesLeft(
string $key,
int $maxAttempts)
Get the number of retries left for the given key.
void
clear(
string $key)
Clear the hits and lockout for the given key.
int
availableIn(
string $key)
Get the number of seconds until the "key" is accessible again.
Details
at line line 35
bool
tooManyAttempts(
string $key,
int $maxAttempts,
int $decayMinutes = 1)
Determine if the given key has been "accessed" too many times.
at line line 59
int
hit(
string $key,
int $decayMinutes = 1)
Increment the counter for a given key for a given decay time.
at line line 95
int
retriesLeft(
string $key,
int $maxAttempts)
Get the number of retries left for the given key.
at line line 121
int
availableIn(
string $key)
Get the number of seconds until the "key" is accessible again.