public function loadAllowance($request, $action)
    {
        $allowance = Yii::$app->cache->get($action->controller->id . ':' . $action->id . ':' . $this->id . '_allowance');
        $allowanceUpdatedAt = Yii::$app->cache->get($action->controller->id . ':' . $action->id . ':' . $this->id . '_allowance_update_at');
        if ($allowance && $allowanceUpdatedAt) {
            return [$allowance, $allowanceUpdatedAt];
        } else {
            return [Yii::$app->settings->get('requestRateLimit', 'user', 60), time()];
        }
    }
public function loadAllowance($request, $action)
    {
        $allowance = Yii::$app->cache->get($action->controller->id . ':' . $action->id . ':' . $this->id . '_allowance');
        $allowanceUpdatedAt = Yii::$app->cache->get($action->controller->id . ':' . $action->id . ':' . $this->id . '_allowance_update_at');
        if ($allowance && $allowanceUpdatedAt) {
            return [$allowance, $allowanceUpdatedAt];
        } else {
            return [Yii::$app->settings->get('requestRateLimit', 'user', 60), time()];
        }
    }
public function loadAllowance ( $ request , $ action ) { $ allowance = Yii :: $ app -> cache -> get ( $ action -> controller -> id . ':' . $ action -> id . ':' . $ this -> id . '_allowance' ) ; $ allowanceUpdatedAt = Yii :: $ app -> cache -> get ( $ action -> controller -> id . ':' . $ action -> id . ':' . $ this -> id . '_allowance_update_at' ) ; if ( $ allowance && $ allowanceUpdatedAt ) { return [ $ allowance , $ allowanceUpdatedAt ] ; } else { return [ Yii :: $ app -> settings -> get ( 'requestRateLimit' , 'user' , 60 ) , time ( ) ] ; } }
Loads the number of allowed requests and the corresponding timestamp from a persistent storage.
@param \yii\web\Request $request the current request
@param \yii\base\Action $action the action to be executed
@return array an array of two elements. The first element is the number of allowed requests,
and the second element is the corresponding UNIX timestamp.
Loads the number of allowed requests and the corresponding timestamp from a persistent storage .