ThrottleRule
ThrottleRule Class.
Represents a request throttling rule.
Tags
Table of Contents
$method | string | |
---|---|---|
$interval | int | |
$delays | int[] | |
__construct() | Create a new ThrottleRule object. | mixed |
getDelay() | Get the current delay on this rule for a particular number of event counts. | mixed |
getDelays() | Gets the current mapping of attempts (int) to delays (seconds). | int[] |
getInterval() | Gets the current throttling interval (seconds). | int |
getMethod() | Gets the current throttling method ('ip' or 'data'). | string |
setDelays() | Sets the current mapping of attempts (int) to delays (seconds). | mixed |
setInterval() | Sets the current throttling interval (seconds). | mixed |
setMethod() | Sets the current throttling method ('ip' or 'data'). | mixed |
Properties
$method
protected
string
$method
$interval
protected
int
$interval
$delays
protected
int[]
$delays
Methods
__construct()
Create a new ThrottleRule object.
public
__construct(
$method :
string
, $interval :
int
, $delays :
int[]
)
: mixed
Parameters
- $method : string
Set to 'ip' for ip-based throttling, 'data' for request-data-based throttling.
- $interval : int
The amount of time, in seconds, to look back in determining attempts to consider.
- $delays : int[]
A mapping of minimum observation counts (x) to delays (y), in seconds.
Return values
mixedgetDelay()
Get the current delay on this rule for a particular number of event counts.
public
getDelay(
$lastEventTime :
Carbon
, $count :
int
)
: mixed
Parameters
- $lastEventTime : Carbon
The timestamp for the last countable event.
- $count : int
The total number of events which have occurred in an interval.
Return values
mixedgetDelays()
Gets the current mapping of attempts (int) to delays (seconds).
public
getDelays(
)
: int[]
Return values
int[]getInterval()
Gets the current throttling interval (seconds).
public
getInterval(
)
: int
Return values
intgetMethod()
Gets the current throttling method ('ip' or 'data').
public
getMethod(
)
: string
Return values
stringsetDelays()
Sets the current mapping of attempts (int) to delays (seconds).
public
setDelays(
$delays :
int[]
)
: mixed
Parameters
- $delays : int[]
A mapping of minimum observation counts (x) to delays (y), in seconds.
Return values
mixedsetInterval()
Sets the current throttling interval (seconds).
public
setInterval(
$interval :
int
)
: mixed
Parameters
- $interval : int
The amount of time, in seconds, to look back in determining attempts to consider.
Return values
mixedsetMethod()
Sets the current throttling method ('ip' or 'data').
public
setMethod(
$method :
string
)
: mixed
Parameters
- $method : string
Set to 'ip' for ip-based throttling, 'data' for request-data-based throttling.