/** * 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; }
/** * 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; }