Method | Description | |
---|---|---|
getRateLimit ( |
Returns the maximum number of allowed requests and the window size. | |
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. |
public getRateLimit ( |
||
$request | the current request | |
$action | the action to be executed | |
return | 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. |
public loadAllowance ( |
||
$request | the current request | |
$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. |
public saveAllowance ( |
||
$request | the current request | |
$action | the action to be executed | |
$allowance | integer | the number of allowed requests remaining. |
$timestamp | integer | the current timestamp. |