1 | <?php |
||
9 | abstract class AbstractTTLRateLimiter implements RateLimiter, SilentRateLimiter |
||
10 | { |
||
11 | /** |
||
12 | * @var string |
||
13 | */ |
||
14 | private $keyPrefix; |
||
15 | |||
16 | public function __construct(string $keyPrefix = '') |
||
20 | |||
21 | final public function limit(string $identifier, Rate $rate): void |
||
32 | |||
33 | final public function limitSilently(string $identifier, Rate $rate): Status |
||
49 | |||
50 | private function key(string $identifier, int $interval): string |
||
54 | |||
55 | abstract protected function getCurrent(string $key): int; |
||
56 | |||
57 | abstract protected function updateCounter(string $key, int $interval): int; |
||
58 | |||
59 | abstract protected function ttl(string $key): int; |
||
60 | } |
||
61 |