本文整理汇总了PHP中CGlobal::memcache_connect_id方法的典型用法代码示例。如果您正苦于以下问题:PHP CGlobal::memcache_connect_id方法的具体用法?PHP CGlobal::memcache_connect_id怎么用?PHP CGlobal::memcache_connect_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGlobal
的用法示例。
在下文中一共展示了CGlobal::memcache_connect_id方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: connect
static function connect()
{
if (!CGlobal::$memcache_connect_id && !eb_memcache::$crashed) {
if (!function_exists('memcache_connect')) {
//dl("php_memcache.dll");
//dl("php_xdebug.dll");
eb_memcache::$crashed = 1;
return FALSE;
}
eb_memcache::$identifier = MEMCACHE_ID;
//eb_memcache::$identifier = 'chonmon.vn';
if (!CGlobal::$memcache_server || !count(CGlobal::$memcache_server)) {
eb_memcache::$crashed = 1;
return FALSE;
}
if (DEBUG) {
$rtime = microtime();
$rtime = explode(" ", $rtime);
$rtime = $rtime[1] + $rtime[0];
$start_rb = $rtime;
}
for ($i = 0, $n = count(CGlobal::$memcache_server); $i < $n; $i++) {
$server = CGlobal::$memcache_server[$i];
if ($i < 1) {
CGlobal::$memcache_connect_id = memcache_connect($server['host'], $server['port']);
} else {
memcache_add_server(CGlobal::$memcache_connect_id, $server['host'], $server['port']);
}
if (DEBUG) {
$mtime = microtime();
$mtime = explode(" ", $mtime);
$mtime = $mtime[1] + $mtime[0];
$end_rb = $mtime;
$load_time = round($end_rb - $start_rb, 5) . "s";
CGlobal::$conn_debug .= " <b>Connect to Memcache server : {$server['host']} : {$server['port']} </b> [in {$load_time}]<br>\n";
}
}
if (!CGlobal::$memcache_connect_id) {
eb_memcache::$crashed = 1;
return FALSE;
}
if (function_exists('memcache_set_compress_threshold')) {
memcache_set_compress_threshold(CGlobal::$memcache_connect_id, 20000, 0.2);
}
//memcache_debug( eb_memcache::$debug );
}
return CGlobal::$memcache_connect_id;
}