Ejemplo n.º 1
0
 private function init()
 {
     $arrConf = Util::getConf('/image_predict', 'Memcache');
     $this->_cacheBase = CacheBase::getInstance();
     $this->_cacheBase->setOption(Memcached::OPT_DISTRIBUTION, Memcached::DISTRIBUTION_CONSISTENT);
     $this->_cacheBase->setOption(Memcached::OPT_CONNECT_TIMEOUT, $arrConf['CONNECT_TIMEOUT']);
     $this->_cacheBase->setOption(Memcached::OPT_SEND_TIMEOUT, $arrConf['SEND_TIMEOUT']);
     $this->_cacheBase->setOption(Memcached::OPT_RECV_TIMEOUT, $arrConf['RECV_TIMEOUT']);
     foreach ($arrConf['Servers'] as $key => $val) {
         $serverInfo = explode(' ', $val);
         $rc = $this->_cacheBase->addServer($serverInfo[0], $serverInfo[1]);
         if (false === $rc) {
             CLog::warning("ImgPredict addServer failed," . $this->_cacheBase->getErrMsg());
         }
     }
 }