| Total Lines | 21 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | "callback" => function () { |
||
| 12 | $cache = new \Anax\Cache\FileCache(); |
||
| 13 | |||
| 14 | // Load the configuration files |
||
| 15 | $cfg = $this->get("configuration"); |
||
|
|
|||
| 16 | $config = $cfg->load("cache.php"); |
||
| 17 | $file = $config["file"] ?? null; |
||
| 18 | $config = $config["config"] ?? null; |
||
| 19 | |||
| 20 | $path = $config["basePath"] ?? null; |
||
| 21 | if (!$path || !is_dir($path) || !is_writable($path)) { |
||
| 22 | throw new Exception("Configuration file '$file': Cachedir '$path' is not a writable directory."); |
||
| 23 | } |
||
| 24 | $cache->setPath($path); |
||
| 25 | |||
| 26 | $timeToLive = $config["timeToLive"] ?? null; |
||
| 27 | if ($timeToLive) { |
||
| 28 | $cache->setTimeToLive($timeToLive); |
||
| 29 | } |
||
| 30 | |||
| 31 | return $cache; |
||
| 32 | } |
||
| 36 |