IpRateLimitIdentity ​
- Type
- Class
- Namespace
- craft\commerce\filters
- Inherits
- craft\commerce\filters\IpRateLimitIdentity » yii\base\BaseObject
- Implements
- yii\base\Configurable, yii\filters\RateLimitInterface
- Since
- 4.11.2
IP-based rate limit identity for use with RateLimiter.
Public Properties ​
| Property | Description |
|---|---|
| ip | |
| keyPrefix | |
| limit | |
| window |
ip ​
- Default value
null
keyPrefix ​
- Default value
null
limit ​
- Default value
null
window ​
- Default value
null
Public Methods ​
| Method | Description |
|---|---|
| __call() | Calls the named method which is not a class method. |
| __construct() | Constructor. |
| __get() | Returns the value of an object property. |
| __isset() | Checks if a property is set, i.e. defined and not null. |
| __set() | Sets value of an object property. |
| __unset() | Sets an object property to null. |
| canGetProperty() | Returns a value indicating whether a property can be read. |
| canSetProperty() | Returns a value indicating whether a property can be set. |
| className() | Returns the fully qualified name of this class. |
| getRateLimit() | Returns the maximum number of allowed requests and the window size. |
| hasMethod() | Returns a value indicating whether a method is defined. |
| hasProperty() | Returns a value indicating whether a property is defined. |
| init() | Initializes the object. |
| loadAllowance() | Loads the number of allowed requests and the corresponding timestamp from a persistent storage. |
| saveAllowance() | 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.
Arguments ​
$request(yii\web\Request) – The current request$action(yii\base\Action) – The action to be executed
Returns ​
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.
Arguments ​
$request(yii\web\Request) – The current request$action(yii\base\Action) – The action to be executed
Returns ​
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.
Arguments ​
$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.