| Conditions | 3 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 50 | public function set(string $key, string $value, ?int $lifeTime = null): CacheInterface |
||
| 51 | { |
||
| 52 | if ($lifeTime !== null && $lifeTime <= 0) { |
||
| 53 | throw new InvalidLifeTimeException('The life time value must be greater then zero or null!'); |
||
| 54 | } |
||
| 55 | |||
| 56 | $cacheItem = $this->cacheAdapter->getItem($key); |
||
| 57 | |||
| 58 | $cacheItem->set($value) |
||
| 59 | ->expiresAfter($lifeTime); |
||
| 60 | |||
| 61 | $this->cacheAdapter->save($cacheItem); |
||
| 62 | |||
| 63 | return $this; |
||
| 64 | } |
||
| 66 |