1 | <?php |
||
8 | trait CacheableTrait |
||
9 | { |
||
10 | /** |
||
11 | * Get the base class name, without 'Repository' suffix. |
||
12 | * |
||
13 | * @return string |
||
14 | */ |
||
15 | protected function baseClassName(): string |
||
25 | |||
26 | /** |
||
27 | * Return the cache duration value in seconds, |
||
28 | * which would be used by the repository. |
||
29 | * |
||
30 | * @return int |
||
31 | */ |
||
32 | public function cacheDuration(): int |
||
40 | |||
41 | /** |
||
42 | * Return an array of method names which |
||
43 | * you don't wish to be cached. |
||
44 | * |
||
45 | * @return array |
||
46 | */ |
||
47 | public function cacheExcept(): array |
||
57 | |||
58 | /** |
||
59 | * Generate cache key. |
||
60 | * |
||
61 | * @param string $method |
||
62 | * @param mixed $args |
||
63 | * |
||
64 | * @return string |
||
65 | */ |
||
66 | public function cacheKey($method, $args): string |
||
73 | |||
74 | /** |
||
75 | * Return the cache tags which would |
||
76 | * be used by the repository. |
||
77 | * |
||
78 | * @return mixed |
||
79 | */ |
||
80 | public function cacheTags() |
||
88 | |||
89 | /** |
||
90 | * Return the primary model object which would |
||
91 | * be used by the repository. |
||
92 | * |
||
93 | * @return \Suitmedia\Cacheable\Contracts\CacheableModel |
||
94 | */ |
||
95 | abstract public function model(): CacheableModel; |
||
96 | } |
||
97 |