Exemple #1
0
 /**
  * Saves the given cache
  * Prevents broken cache when write_control is disabled and displays problems by log or error
  *
  * @param  mixed  $data
  * @param  string $id
  * @return boolean Returns false when the cache has not been written
  */
 protected function saveCache($data, $id)
 {
     if (self::$_cacheTags) {
         self::$_cache->save($data, $id, array($this->_options['tag']));
     } else {
         self::$_cache->save($data, $id);
     }
     if (!self::$_cache->test($id)) {
         if (!$this->_options['disableNotices']) {
             if ($this->_options['log']) {
                 $this->_options['log']->log("Writing to cache failed.", $this->_options['logPriority']);
             } else {
                 trigger_error("Writing to cache failed.", E_USER_NOTICE);
             }
         }
         self::$_cache->remove($id);
         return false;
     }
     return true;
 }