PHP Интерфейс yii\filters\RateLimitInterface

С версии: 2.0
Автор: Qiang Xue ([email protected])
Показать файл Открыть проект Примеры использования интерфейса

Открытые методы

Метод Описание
getRateLimit ( Request $request, Action $action ) : array Returns the maximum number of allowed requests and the window size.
loadAllowance ( Request $request, Action $action ) : array Loads the number of allowed requests and the corresponding timestamp from a persistent storage.
saveAllowance ( Request $request, Action $action, integer $allowance, integer $timestamp ) Saves the number of allowed requests and the corresponding timestamp to a persistent storage.

Описание методов

getRateLimit() публичный Метод

Returns the maximum number of allowed requests and the window size.
public getRateLimit ( Request $request, Action $action ) : array
$request yii\web\Request the current request
$action yii\base\Action the action to be executed
Результат array an array of two elements. The first element is the maximum number of allowed requests, and the second element is the size of the window in seconds.

loadAllowance() публичный Метод

Loads the number of allowed requests and the corresponding timestamp from a persistent storage.
public loadAllowance ( Request $request, Action $action ) : array
$request yii\web\Request the current request
$action yii\base\Action the action to be executed
Результат array an array of two elements. The first element is the number of allowed requests, and the second element is the corresponding UNIX timestamp.

saveAllowance() публичный Метод

Saves the number of allowed requests and the corresponding timestamp to a persistent storage.
public saveAllowance ( Request $request, Action $action, integer $allowance, integer $timestamp )
$request yii\web\Request the current request
$action yii\base\Action the action to be executed
$allowance integer the number of allowed requests remaining.
$timestamp integer the current timestamp.