Conditions | 4 |
Paths | 6 |
Total Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 0 |
1 | <?php |
||
43 | public function save($key, CacheEntry $data) |
||
44 | { |
||
45 | try { |
||
46 | $lifeTime = $this->getLifeTime($data); |
||
47 | if ($lifeTime === 0) { |
||
48 | return $this->cache->forever( |
||
49 | $key, |
||
50 | serialize($data) |
||
51 | ); |
||
52 | } else if ($lifeTime > 0) { |
||
53 | return $this->cache->add( |
||
54 | $key, |
||
55 | serialize($data), |
||
56 | $lifeTime |
||
57 | ); |
||
58 | } |
||
59 | } catch (\Exception $ignored) { |
||
60 | // No fail if we can't save it the storage |
||
61 | } |
||
62 | |||
63 | return false; |
||
64 | } |
||
65 | |||
85 |