| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 38 | public function get(string $cacheKey, callable $callback, DateInterval|int $expiresAfter = null): mixed |
||
| 39 | { |
||
| 40 | $cacheItem = $this->cacheInstance->getItem($cacheKey); |
||
| 41 | |||
| 42 | if (! $cacheItem->isHit()) { |
||
| 43 | /* |
||
| 44 | * Parameter $cacheItem will be available as of 8.0.6 |
||
| 45 | */ |
||
| 46 | $cacheItem->set($callback($cacheItem)); |
||
| 47 | if ($expiresAfter) { |
||
| 48 | $cacheItem->expiresAfter($expiresAfter); |
||
| 49 | } |
||
| 50 | |||
| 51 | $this->cacheInstance->save($cacheItem); |
||
| 52 | } |
||
| 53 | |||
| 54 | return $cacheItem->get(); |
||
| 55 | } |
||
| 62 |