File
Less than 1 minute
File
Rate limiter backend using file-based storage.
class File extends \Hazaar\Util\RateLimiter\BackendExtends: Hazaar\Util\RateLimiter\Backend
This backend implementation uses a BTree database to store and manage rate limiting data. It supports configurable file paths and compaction intervals for efficient storage management.
Properties
db
The BTree database instance used for storing rate limiter data.
private BTree $dbType: Hazaar\Util\BTree
created
public int $createdType: int
compactInterval
The interval (in seconds) after which the database should be compacted.
private int $compactInterval = 3600Type: int
Methods
__construct
File rate limiter constructor.
public __construct(array|Options $options): voidParameters
| Parameter | Type | Description |
|---|---|---|
$options | array | Hazaar\Util\RateLimiter\Backend\File\Options |
get
public get(string $identifier): arrayReturns: array
Parameters
| Parameter | Type | Description |
|---|---|---|
$identifier | string |
set
public set(string $identifier, array $log): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$identifier | string | |
$log | array |
remove
public remove(string $identifier): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$identifier | string |
getKey
BTree keys are limited to 32 characters, so identifiers are hashed to exactly that length.
private getKey(string $identifier): stringReturns: string
Parameters
| Parameter | Type | Description |
|---|---|---|
$identifier | string |
Generated by Hazaar API Doc Generator on Thu, 22 Oct 2026 05:05:29 +0000