示例#1
0
 /**
  * get roma-client instance.
  * @param hosts - ["127.0.0.1:11211", "127.0.0.1:11212"] |
  *                ["-d", "127.0.0.1:12345"]
  */
 public static function getInstance($hosts)
 {
     $hosts_string = "";
     foreach ($hosts as &$value) {
         $hosts_string = $hosts_string . "," . $value;
     }
     $hosts_string = substr(0, strlen($hosts_string), $hosts_string);
     RomaClient::$romaclient = new RomaClient($hosts_string);
     return RomaClient::$romaclient;
 }
示例#2
0
文件: RomaClient.php 项目: keiju/roma
 /**
  * get roma-client instance.
  *
  * @param hosts (array)
  */
 public static function getInstance($hosts)
 {
     $hosts_string = "";
     foreach ($hosts as &$value) {
         $hosts_string .= $value . ",";
     }
     $hosts_string = substr($hosts_string, 0, strlen($hosts_string) - 1);
     //echo $hosts_string, "<br/>";
     $result = rmc_connect($hosts_string);
     if ($result == 1) {
         return False;
     }
     RomaClient::$romaclient = new RomaClient();
     return RomaClient::$romaclient;
 }