File
File
Properties
db
private BTree $dbindex
private array $indexcreated
public int $createdcompactInterval
private int $compactInterval = 3600Methods
__construct
File rate limiter constructor.
public __construct(array $options): voidParameters
| Parameter | Type | Description |
|---|---|---|
$options | array | the options for the file |
shutdown
Performs shutdown operations for the rate limiter backend.
public shutdown(): voidThis method saves any updated rate limit information to the database and, if the compact interval has elapsed since creation, compacts the database to optimize storage.
check
Checks and updates the rate limit information for a given identifier.
public check(string $identifier): voidRetrieves the current rate limit data for the specified identifier, appends the current timestamp to the log, updates the internal index, and returns the updated information.
Parameters
| Parameter | Type | Description |
|---|---|---|
$identifier | string | the unique identifier to check and update rate limit information for |
get
Retrieves and updates the rate limit information for a given identifier.
public get(string $identifier): voidThis method fetches the rate limit log for the specified identifier from the database. It removes any log entries that are outside the configured time window (windowLength). If no log exists for the identifier, it initializes an empty log.
Parameters
| Parameter | Type | Description |
|---|---|---|
$identifier | string | the unique identifier for which to retrieve rate limit information |
remove
Removes the rate limiter entry associated with the given identifier.
public remove(string $identifier): voidParameters
| Parameter | Type | Description |
|---|---|---|
$identifier | string | the unique identifier for the rate limiter entry to remove |
Generated by Hazaar API Doc Generator on Sun, 01 Mar 2026 09:22:26 +0000