conn) { $this->conn = new Memcache(); $server = Config::get('cache.server'); if (is_multi_array($server)) { foreach ($server as $value) { $this->conn->addserver($value['host'], $value['port']); } } else { $this->conn->addserver($server['host'], $server['port']); } } return $this->conn; } // 设置值 public function set($key, $value) { $memcache = $this->conn(); return $memcache->set($key, $value); } // 读取值 public function get($key) { $memcache = $this->conn(); return $memcache->get($key); } // 删除 public function delete($key) { $memcache = $this->conn(); return $memcache->delete($key); } // 清理所有 public function flush() { $memcache = $this->conn(); return $memcache->flush(); } // 版本信息 public function status() { $memcache = $this->conn(); return $memcache->getExtendedStats(); } // 关闭连接 public function __destruct() { $memcache = $this->conn(); $memcache->close(); } }