| Total Complexity | 4 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | trait WithCachedRows |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Whatever we use the cache or not. |
||
| 11 | * |
||
| 12 | * @var bool |
||
| 13 | */ |
||
| 14 | protected $useCache = false; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Modify the option to use the cache. |
||
| 18 | * |
||
| 19 | * @return void |
||
| 20 | */ |
||
| 21 | public function useCachedRows(): void |
||
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Function to store and get back queries result from the cache. |
||
| 28 | * |
||
| 29 | * @param mixed $callback The callback function. (The query stored) |
||
| 30 | * |
||
| 31 | * @return mixed |
||
| 32 | * |
||
| 33 | * @throws InvalidArgumentException |
||
| 34 | */ |
||
| 35 | public function cache($callback) |
||
| 53 |