| Conditions | 4 |
| Paths | 10 |
| Total Lines | 27 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 25 | public function call() |
||
| 26 | { |
||
| 27 | $builder = $this->getBuilder(); |
||
| 28 | |||
| 29 | $key = $this->getParam('key', self::DEFAULT_KEY); |
||
| 30 | $value = $this->getParam('value', self::DEFAULT_VALUE); |
||
| 31 | $minutes = $this->getParam('minutes', self::DEFAULT_MINUTES); |
||
| 32 | |||
| 33 | try { |
||
| 34 | $result = CacheFacade::add($key, $value, $minutes); |
||
| 35 | |||
| 36 | if ($result) { |
||
| 37 | $valueCached = CacheFacade::get($key); |
||
| 38 | |||
| 39 | if ($valueCached !== $value) { |
||
| 40 | $builder->down()->withData("error", "Value mismatch."); |
||
| 41 | } |
||
| 42 | } else { |
||
| 43 | $builder->down()->withData("error", "Could not add key."); |
||
| 44 | } |
||
| 45 | |||
| 46 | CacheFacade::delete($key); |
||
| 47 | } catch (\Exception $exception) { |
||
| 48 | $builder->down()->withData("error", "Cache Error - " . $exception->getMessage()); |
||
| 49 | } |
||
| 50 | |||
| 51 | return $builder->build(); |
||
| 52 | } |
||
| 54 |