RateLimiter (Cache)

RateLimiter

class RateLimiter (View source)

Methods

void __construct( Repository $cache)

Create a new rate limiter instance.

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.

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

void __construct( Repository $cache)

Create a new rate limiter instance.

Parameters

Repository $cache

Return Value

void

bool tooManyAttempts( string $key, int $maxAttempts, int $decayMinutes = 1)

Determine if the given key has been "accessed" too many times.

Parameters

string $key
int $maxAttempts
int $decayMinutes

Return Value

bool

int hit( string $key, int $decayMinutes = 1)

Increment the counter for a given key for a given decay time.

Parameters

string $key
int $decayMinutes

Return Value

int

mixed attempts( string $key)

Get the number of attempts for the given key.

Parameters

string $key

Return Value

mixed

void clear( string $key)

Clear the hits and lockout for the given key.

Parameters

string $key

Return Value

void

int availableIn( string $key)

Get the number of seconds until the "key" is accessible again.

Parameters

string $key

Return Value

int

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.1/Illuminate/Cache/RateLimiter.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部