/**
  * Fetch HTML
  *
  * @param string $tpl
  * @param string $dir
  */
 public function fetch($tpl = null, $dir = null)
 {
     try {
         if ($this->_cacheKey && empty($this->_cache)) {
             $this->initCache();
         }
         if ($this->_cacheKey && $this->_cache && ($data = $this->_cache->get($this->_cacheKey))) {
             return $data;
         }
         $this->_init($this->_arg);
         foreach ($this->_update as $key => $value) {
             $this->view->{$key} = $value;
         }
         if (empty($tpl)) {
             $tpl = $this->defaultTemplate();
         }
         if (empty($dir)) {
             $dir = Cola::config('_widgetsHome');
         }
         $data = $this->view->fetch($tpl, $dir);
         if ($this->_cacheKey && $this->_cache) {
             $this->_cache->set($this->_cacheKey, $data);
         }
     } catch (Exception $e) {
         $data = '';
     }
     return $data;
 }
 public static function cache($name = null)
 {
     if (is_array($name)) {
         return Cola_Com_Cache::factory($name);
     }
     if (empty($name)) {
         $name = '_cache';
     }
     if ($cache = Cola::reg($name)) {
         return $cache;
     }
     $config = (array) Cola::config($name);
     $cache = Cola_Com_Cache::factory($config);
     Cola::reg($name, $cache);
     return $cache;
 }