Total Complexity | 8 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php namespace GeneaLabs\LaravelModelCaching\Traits; |
||
8 | trait Cachable |
||
9 | { |
||
10 | protected $isCachable = true; |
||
11 | |||
12 | protected function cache(array $tags = []) |
||
29 | } |
||
30 | |||
31 | public function disableCache() |
||
32 | { |
||
33 | session(['genealabs-laravel-model-caching-is-disabled' => true]); |
||
34 | $this->isCachable = false; |
||
35 | |||
36 | return $this; |
||
37 | } |
||
38 | |||
39 | public function flushCache(array $tags = []) |
||
40 | { |
||
41 | $this->cache($tags)->flush(); |
||
42 | } |
||
43 | |||
44 | protected function makeCacheKey(array $columns = ['*'], $idColumn = null) : string |
||
45 | { |
||
46 | return (new CacheKey($this->eagerLoad, $this->model, $this->query)) |
||
3 ignored issues
–
show
|
|||
47 | ->make($columns, $idColumn); |
||
48 | } |
||
49 | |||
50 | protected function makeCacheTags() : array |
||
54 | } |
||
55 | } |
||
56 |