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