public function __construct() { $appFolder = Config::getInstance()->getFolderPath('app'); $this->setRootFolder($appFolder . 'cache/'); // also include all custom caches that extend BaseCache $this->modelCache = ModelCache::getInstance()->setRootFolder($appFolder . 'cache/'); $this->templateCache = TemplateCache::getInstance()->setRootFolder($appFolder . 'cache/'); }
/** * Returns normal set of metadata for the table that is set in the constructor * * @return array|bool|mixed */ public function getMetadata() { // Try to get the model from the cache $cacheExists = !is_null($this->cache); $modelMetadata = $cacheExists ? $this->cache->getModelMetadata($this->tableName) : false; if (!$modelMetadata) { // Get the metadata and store it in the cache $modelMetadata = Database::getTableMetadata($this->tableName); if (count($modelMetadata) > 0 && $cacheExists) { $this->cache->setModelMetadata($this->tableName, $modelMetadata); } else { // @TODO report if needed } } return $modelMetadata; }