Conditions | 5 |
Paths | 8 |
Total Lines | 23 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
16 | public function cacheResult($args, $phpCode, $widget) |
||
17 | { |
||
18 | $key = $this->_makeCacheKey($args, $widget); |
||
19 | |||
20 | $cache = app('cache'); |
||
21 | |||
22 | if (is_array($widget->cacheTags)) { |
||
23 | $cache = $cache->tags($widget->cacheTags); |
||
24 | } |
||
25 | |||
26 | if ($widget->cacheLifeTime > 0) { |
||
27 | return $cache->remember($key, $widget->cacheLifeTime, $phpCode); |
||
28 | } |
||
29 | |||
30 | if ($widget->cacheLifeTime < 0) { |
||
31 | return $cache->rememberForever($key, $phpCode); |
||
32 | } |
||
33 | |||
34 | if ($widget->cacheLifeTime === 0) { |
||
35 | return $phpCode(); |
||
36 | } |
||
37 | return null; |
||
38 | } |
||
39 | |||
53 |