Interface Yiisoft\Yii\RateLimiter\Policy\LimitPolicyInterface
| Implemented by | Yiisoft\Yii\RateLimiter\Policy\LimitAlways, Yiisoft\Yii\RateLimiter\Policy\LimitCallback, Yiisoft\Yii\RateLimiter\Policy\LimitPerIp |
|---|
Defines policy for limiting requests i.e. which requests should be hit-counted together and which should be counted separately.
For example, a user ID-based fingerprint will make rate limiting apply to current user requests only. An API token-based fingerprint will make rate limiting to apply to all requests with the same token.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| fingerprint() | Returns request fingerprint. Two requests with the same fingerprint increase request counter. Requests with different fingerprints are counted and limited separately. | Yiisoft\Yii\RateLimiter\Policy\LimitPolicyInterface |
Method Details
Returns request fingerprint. Two requests with the same fingerprint increase request counter. Requests with different fingerprints are counted and limited separately.
| public abstract string fingerprint ( \Psr\Http\Message\ServerRequestInterface $request ) | ||
| $request | \Psr\Http\Message\ServerRequestInterface |
Request to get fingerprint for. |
| return | string |
A fingerprint based on the request information. |
|---|---|---|
public function fingerprint(ServerRequestInterface $request): string;
Signup or Login in order to comment.