| Conditions | 4 |
| Paths | 4 |
| Total Lines | 22 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 2 | Features | 1 |
| 1 | <?php |
||
| 56 | public function save($key, CacheEntry $data) |
||
| 57 | { |
||
| 58 | if ($this->lastItem && $this->lastItem->getKey() == $key) { |
||
| 59 | $item = $this->lastItem; |
||
| 60 | } else { |
||
| 61 | $item = $this->cachePool->getItem($key); |
||
| 62 | } |
||
| 63 | |||
| 64 | $this->lastItem = null; |
||
| 65 | |||
| 66 | $item->set($data); |
||
| 67 | |||
| 68 | $ttl = $data->getTTL(); |
||
| 69 | if ($ttl === 0) { |
||
| 70 | // No expiration |
||
| 71 | $item->expiresAfter(null); |
||
| 72 | } else { |
||
| 73 | $item->expiresAfter($ttl); |
||
| 74 | } |
||
| 75 | |||
| 76 | return $this->cachePool->save($item); |
||
| 77 | } |
||
| 78 | } |
||
| 79 |