Total Complexity | 3 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class MemcachedRateLimiter extends BaseRateLimiter |
||
9 | { |
||
10 | /** |
||
11 | * @var string $hostname |
||
12 | */ |
||
13 | public $hostname = 'localhost'; |
||
14 | |||
15 | /** |
||
16 | * @var int $port |
||
17 | */ |
||
18 | public $port = 11211; |
||
19 | |||
20 | public $ttl = 3600; |
||
21 | |||
22 | public $prefix = 'rate_limiter:'; |
||
23 | |||
24 | 2 | protected function initManager(): ManagerInterface |
|
25 | { |
||
26 | 2 | return new MemcachedManager($this->capacity, $this->rate, $this->getLogger(), $this->getMemcached(), $this->ttl, $this->prefix); |
|
27 | } |
||
28 | |||
29 | private $memcached; |
||
30 | |||
31 | 2 | protected function getMemcached(): \Memcached |
|
39 | } |
||
40 | } |
||
41 |