/** * Construct the database cache adapter * * @param array $config */ public function __construct(array $config) { // set some defaults if it wasn't set in config if (!array_key_exists('connection', $config)) { $config['connection'] = null; } if (!isset($config['table'])) { $config['table'] = 'cache'; } parent::__construct($config); }
/** * Construct the object by array of config properties. Config keys are set * in config/cache.php and this array will contain only block for the * requested cache driver. Yes, you can also build this manually, but that * is not recommended. * * @param array $config * @throws \Koldy\Exception */ public function __construct(array $config) { // because if cache is not enabled, then lets not do anything else if (!isset($config['path']) || $config['path'] === null) { $this->path = Application::getStoragePath('cache/'); } else { $this->path = $config['path']; } if (substr($this->path, -1) != '/') { $this->path .= '/'; } if (!is_dir($this->path) && !Directory::mkdir($this->path, 0777)) { throw new Exception("Cache directory '{$this->path}' doesn't exists and can't be created"); } parent::__construct($config); }