Conditions | 2 |
Paths | 2 |
Total Lines | 10 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | 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 | if (! $this->redis->get($serviceName)) { |
||
17 | $this->redis->incr($serviceName); |
||
18 | return (bool) $this->redis->expire($serviceName, $timeWindow); |
||
19 | } |
||
20 | |||
21 | return (bool) $this->redis->incr($serviceName); |
||
22 | } |
||
36 |