Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 5 | ||
Bugs | 1 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
12 | public function incrementFailure(string $service, int $timeWindow): bool |
||
13 | { |
||
14 | $serviceName = $this->makeNamespace($service) . ':failures'; |
||
15 | |||
16 | $this->resetKeyIfInfiniteTTL($serviceName); |
||
17 | |||
18 | if (! $this->redis->get($serviceName)) { |
||
19 | $this->redis->incr($serviceName); |
||
20 | return (bool) $this->redis->expire($serviceName, $timeWindow); |
||
21 | } |
||
22 | |||
23 | return (bool) $this->redis->incr($serviceName); |
||
24 | } |
||
38 |