Skip to content

RateLimiter

  • Full name: \Codefy\Framework\Http\Throttle\RateLimiter

Properties

conditions

private \Codefy\Framework\Http\Throttle\Condition[] $conditions

cache

private \Psr\Cache\CacheItemPoolInterface $cache

Methods

__construct

public __construct(\Psr\Cache\CacheItemPoolInterface $cache): mixed

Parameters:

Parameter Type Description
$cache \Psr\Cache\CacheItemPoolInterface

add

public add(\Codefy\Framework\Http\Throttle\Condition $condition): \Codefy\Framework\Http\Throttle\RateLimiter

Parameters:

Parameter Type Description
$condition \Codefy\Framework\Http\Throttle\Condition

increment

public increment(string $identifier, int $count = 1): $this

Parameters:

Parameter Type Description
$identifier string
$count int

Throws:


getIntervals

public getIntervals(string $identifier): \Codefy\Framework\Http\Throttle\Interval[]

Parameters:

Parameter Type Description
$identifier string

Throws:


reset

Reset counter

public reset(string $identifier): $this

Parameters:

Parameter Type Description
$identifier string

Throws:


getItem

private getItem(string $identifier, \Codefy\Framework\Http\Throttle\Condition $condition): \Psr\Cache\CacheItemInterface

Parameters:

Parameter Type Description
$identifier string
$condition \Codefy\Framework\Http\Throttle\Condition

Throws:



Automatically generated on 2025-10-13