class
Illuminate
/
Cache
/
RateLimiter
You're browsing the documentation for an upcoming version of Laravel. The documentation and features of this release are subject to change.
RateLimiter
Uses
Properties
protected
$limiters array
The configured limit object resolvers.
Default: []
Methods
public
__construct ( Repository $cache ) : void
Create a new rate limiter instance.
Parameters
- $cache Repository
public
for ( string $name , Closure $callback ) : $this
Register a named limiter configuration.
Parameters
- $name string
- $callback Closure
public
limiter ( string $name ) : Closure |null
Get the given named rate limiter.
Parameters
- $name string
public
attempt ( $key , $maxAttempts , Closure $callback , $decaySeconds ) : mixed
Attempts to execute a callback if it's not limited.
Parameters
- $key string
- $maxAttempts int
- $callback Closure
- $decaySeconds int
public
tooManyAttempts ( $key , $maxAttempts ) : bool
Determine if the given key has been "accessed" too many times.
Parameters
- $key string
- $maxAttempts int
public
hit ( $key , $decaySeconds ) : int
Increment the counter for a given key for a given decay time.
Parameters
- $key string
- $decaySeconds int
public
attempts ( $key ) : mixed
Get the number of attempts for the given key.
Parameters
- $key string
public
resetAttempts ( $key ) : mixed
Reset the number of attempts for the given key.
Parameters
- $key string
public
remaining ( $key , $maxAttempts ) : int
Get the number of retries left for the given key.
Parameters
- $key string
- $maxAttempts int
public
retriesLeft ( $key , $maxAttempts ) : int
Get the number of retries left for the given key.
Parameters
- $key string
- $maxAttempts int
public
clear ( $key ) : void
Clear the hits and lockout timer for the given key.
Parameters
- $key string
public
availableIn ( $key ) : int
Get the number of seconds until the "key" is accessible again.
Parameters
- $key string
public
cleanRateLimiterKey ( $key ) : string
Clean the rate limiter key from unicode characters.
Parameters
- $key string