Frequency
class Frequency implements FrequencyInterface, LowFrequencyInterface
Tracks connection frequency to enable low-frequency pool flushing.
Records hits over a time window and calculates average frequency to determine if the pool is in low-frequency mode.
Properties
| protected array<int, int> | $hits | Hit counts by timestamp. |
|
| protected int | $time | Time window in seconds for frequency calculation. |
|
| protected int | $lowFrequency | Threshold below which frequency is considered "low". |
|
| protected int | $beginTime | Time when frequency tracking began. |
|
| protected int | $lowFrequencyTime | Last time low frequency was triggered. |
|
| protected int | $lowFrequencyInterval | Minimum interval between low frequency triggers. |
Methods
No description
Record a hit.
Calculate the average frequency over the time window.
Check if currently in low frequency mode.
Flush old hits outside the time window.
Details
at line 49
__construct()
No description
at line 58
bool
hit(int $number = 1)
Record a hit.
at line 72
float
frequency()
Calculate the average frequency over the time window.
at line 88
bool
isLowFrequency()
Check if currently in low frequency mode.
at line 104
protected void
flush()
Flush old hits outside the time window.