DBI
DBI
Rate limiter backend using a database interface (DBI).
class DBI extends \Hazaar\Util\RateLimiter\BackendExtends: Hazaar\Util\RateLimiter\Backend
This backend implementation uses a database adapter to store and manage rate limiting data. It supports configurable options for database connection and event logging.
Properties
dbi
The database adapter instance used for storing rate limiter data.
private Adapter $dbiType: Hazaar\DBI\Adapter
Methods
__construct
Constructs a new instance of the DBI rate limiter backend.
public __construct(array $options): voidInitializes the database adapter using the provided options.
Parameters
| Parameter | Type | Description |
|---|---|---|
$options | array | configuration options for the database adapter |
get
Gets the request log for an identifier from the rate_limit_log table.
public get(string $identifier): arrayReturns: array
Each row is one allowed request, timestamped by the database's event_time default.
Parameters
| Parameter | Type | Description |
|---|---|---|
$identifier | string |
set
Records the new requests in a log.
public set(string $identifier, array $log): voidReturns: void
Rows are append-only, so this inserts one row for each request the log has beyond what is already stored.
Parameters
| Parameter | Type | Description |
|---|---|---|
$identifier | string | |
$log | array |
remove
public remove(string $identifier): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$identifier | string |
Generated by Hazaar API Doc Generator on Thu, 22 Oct 2026 05:05:29 +0000