Cache
Cache
Properties
cache
private Adapter $cacheprefix
private string $prefix = 'rate_limiter_'index
private array $indexMethods
__construct
Cache rate limiter constructor.
public __construct(array $options): voidParameters
| Parameter | Type | Description |
|---|---|---|
$options | array | the options for the cache |
shutdown
public shutdown(): voidcheck
Checks and updates the rate limit information for a given identifier.
public check(string $identifier): voidRetrieves the current rate limit info for the specified identifier, appends the current timestamp to the log, updates the internal index, and returns the updated info array.
Parameters
| Parameter | Type | Description |
|---|---|---|
$identifier | string | the unique identifier to check and update rate limit info for |
get
Retrieves and returns the rate limiting information for a given identifier.
public get(string $identifier): voidThis method fetches the rate limiting log from the cache using the provided identifier. It removes any log entries that are outside the configured time window. If no log exists, it initializes an empty log array. The resulting information is stored in the local index and returned.
Parameters
| Parameter | Type | Description |
|---|---|---|
$identifier | string | the unique identifier for which to retrieve rate limiting data |
remove
Removes the rate limit information for the specified identifier.
public remove(string $identifier): voidParameters
| Parameter | Type | Description |
|---|---|---|
$identifier | string | the identifier for which to remove the rate limit information |
getKey
Get the key for rate limiting based on the provided identifier.
private getKey(string $identifier): stringParameters
| Parameter | Type | Description |
|---|---|---|
$identifier | string | the identifier used for rate limiting |
Generated by Hazaar API Doc Generator on Sun, 01 Mar 2026 09:22:26 +0000