/** * Parse the template * * This function implements a caching mechanism when reading the template. If * the tempplate cannot be found in the cache it will be filtered and stored in * the cache. Otherwise it will be loaded from the cache and returned directly. * * @return string The filtered data */ public function parse() { if (isset($this->_cache)) { $identifier = md5($this->_path); if (!($template = $this->_cache->get($identifier))) { $template = parent::parse(); //Store the object in the cache $this->_cache->store($template, $identifier); } return $template; } return parent::parse(); }
/** * Parse the data. If a data has been parsed, it will serve it from the cache * * @return string The filtered data */ public function parse() { $path = $this->_contents; if (!isset($this->_parsed_data[$path])) { $this->_parsed_data[$path] = parent::parse(); } return $this->_parsed_data[$path]; }