Пример #1
0
 /**
  * Set a cache
  *
  * @param  string  Cache Key
  * @param  mixed  Cache value
  */
 private function _setCache($path, $value)
 {
     if ($path) {
         // First, update the already-loaded cache with the new value
         $return = kxEnv::getconfig()->setRecursive($path, $value);
         // Are we using an alt cache engine?
         // Update it if so
         if (is_object(self::$cacheLib)) {
             if (!$value) {
                 $value = "NULL";
             }
             self::$cacheLib->update(implode(':', $path), $value);
         }
         // Now update the database
         // Merge does an update if the key exists, otherwise, it inserts
         kxDB::getInstance()->merge("cache")->key(array("cache_path" => implode(':', $path)))->fields(array("cache_array" => intval(is_array($value)), "cache_value" => is_array($value) ? serialize($value) : $value, "cache_updated" => time()))->execute();
         return $return;
     }
 }