예제 #1
0
 /**
  * 初始化缓存配置信息
  * @param array $configs 缓存配置信息
  */
 public function __construct($configs)
 {
     if (!$configs) {
         if (APP_DEBUG) {
             E("必须传入缓存配置信息!");
         }
     }
     $this->configs = $configs;
     $Mem = new \Memcache();
     foreach ($this->configs['server'] as $value) {
         call_user_func_array(array($Mem, 'addServer'), $value);
     }
     if (!$Mem->getstats()) {
         if (APP_DEBUG) {
             E("Unable to connect the Memcache server!");
         }
     }
     self::$Mem = $Mem;
 }
예제 #2
0
 /**
  * 初始化缓存配置信息
  * @param array $configs 缓存配置信息
  */
 public function __construct($configs)
 {
     if (!$configs) {
         if (APP_DEBUG) {
             E("cache configure args is needed!");
         }
     }
     if (!extension_loaded("memcache")) {
         E("please install memcache extension.");
     }
     $this->configs = $configs;
     $Mem = new \Memcache();
     foreach ($this->configs['server'] as $value) {
         call_user_func_array(array($Mem, 'addServer'), $value);
     }
     if (!$Mem->getstats()) {
         if (APP_DEBUG) {
             E("Unable to connect the Memcache server!");
         }
     }
     self::$Mem = $Mem;
 }