| @@ 18-31 (lines=14) @@ | ||
| 15 | $this->cache = $cache; |
|
| 16 | } |
|
| 17 | ||
| 18 | private function getRulesFromCache($file) { |
|
| 19 | //Try to load the cached rules, if not set in the cache (or expired) parse the supplied sheet |
|
| 20 | $rules = $this->cache->load($this->cacheName, filemtime($file)); |
|
| 21 | ||
| 22 | $this->cacheKey = $this->cacheKey ?? $rules['cacheKey'] ?? null; |
|
| 23 | ||
| 24 | if ($rules) { |
|
| 25 | foreach ($rules['import'] as $file) { |
|
| 26 | //Check that the import file hasn't been changed since the cache was written |
|
| 27 | if (filemtime($file) > $rules['ctime']) return false; |
|
| 28 | } |
|
| 29 | } |
|
| 30 | return $rules; |
|
| 31 | } |
|
| 32 | ||
| 33 | public function getCacheKey($tss, $data) { |
|
| 34 | //Read the rules so that $this->cacheKey is set |
|
| @@ 23-37 (lines=15) @@ | ||
| 20 | $this->cacheName = $this->fileName; |
|
| 21 | } |
|
| 22 | ||
| 23 | private function getRulesFromCache($file) { |
|
| 24 | //Try to load the cached rules, if not set in the cache (or expired) parse the supplied sheet |
|
| 25 | $rules = $this->cache->load($this->cacheName, filemtime($file)); |
|
| 26 | ||
| 27 | $this->cacheKey = $this->cacheKey ?? $rules['cacheKey'] ?? null; |
|
| 28 | ||
| 29 | if ($rules) { |
|
| 30 | foreach ($rules['import'] as $file) { |
|
| 31 | //Check that the import file hasn't been changed since the cache was written |
|
| 32 | if (filemtime($file) > $rules['ctime']) return false; |
|
| 33 | } |
|
| 34 | } |
|
| 35 | ||
| 36 | return $rules; |
|
| 37 | } |
|
| 38 | ||
| 39 | public function setCacheKey($tokens) { |
|
| 40 | $this->cacheKey = $tokens; |
|