public function connect() { if (!isset(self::$_cacheObj)) { if (defined('KVSTORE_MEMCACHE_CONFIG') && constant('KVSTORE_MEMCACHE_CONFIG')) { self::$_cacheObj = new Memcached(); $config = explode(',', KVSTORE_MEMCACHE_CONFIG); foreach ($config as $row) { $row = trim($row); if (strpos($row, 'unix:///') === 0) { //self::$_cacheObj->addServer($row, 0); } else { $tmp = explode(':', $row); self::$_cacheObj->addServer($tmp[0], $tmp[1]); } } } else { trigger_error('can\'t load KVSTORE_MEMCACHE_CONFIG, please check it', E_USER_ERROR); } } }
public function connect() { if (!isset(self::$_cacheObj)) { $hosts = (array) config::get('kvstore.base_kvstore_memcached.hosts'); if (!empty($hosts)) { self::$_cacheObj = new Memcached(); foreach ($hosts as $row) { $row = trim($row); if (strpos($row, 'unix:///') === 0) { //self::$_cacheObj->addServer($row, 0); } else { $tmp = explode(':', $row); self::$_cacheObj->addServer($tmp[0], $tmp[1]); } } } else { trigger_error('kvstore:base_kvstore_memcached hosts is empty, please check it', E_USER_ERROR); } } }