当前位置: 首页>>代码示例>>PHP>>正文


PHP Memcache::connect方法代码示例

本文整理汇总了PHP中Memcache::connect方法的典型用法代码示例。如果您正苦于以下问题:PHP Memcache::connect方法的具体用法?PHP Memcache::connect怎么用?PHP Memcache::connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Memcache的用法示例。


在下文中一共展示了Memcache::connect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: connect

 protected function connect()
 {
     $this->_memcache = new \Memcache();
     if (!$this->_memcache->connect($this->config['host'], $this->config['port'])) {
         throw new UpaddException("Connect to memcache server failure({$this->config['host']}:{$this->config['port']})!");
     }
 }
开发者ID:v3u3i87,项目名称:upadd,代码行数:7,代码来源:getMemcache.php

示例2: __construct

 public function __construct($server = 'localhost', $port = 11211)
 {
     if (empty(self::$memcache)) {
         self::$memcache = new \Memcache();
         self::$memcache->connect($server, $port) or die("Could not connect");
     }
 }
开发者ID:kreynen,项目名称:elmsln,代码行数:7,代码来源:CacheMemcache.php

示例3: connect

 function connect()
 {
     if (!$this->connected) {
         $this->cache->connect($this->aConf['host'], $this->aConf['port']) or die("Could not connect");
     }
     return $this->connected;
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:7,代码来源:Cache_memcached.php

示例4: __construct

 public function __construct($host = 'localhost', $port = 11211)
 {
     $this->memcache = new \Memcache();
     if (!$this->memcache->connect($host, $port)) {
         throw new \Exception('Unable to connect to Memcache server');
     }
 }
开发者ID:rafabrutaldrums,项目名称:casamacario,代码行数:7,代码来源:Memcache.php

示例5: __construct

 public function __construct()
 {
     if (class_exists('Memcache')) {
         $this->memcache = new Memcache();
         $config = Vinal::app()->config("cache");
         $this->memcache->connect($config->server, $config->port);
     }
 }
开发者ID:tooby93,项目名称:Resepte,代码行数:8,代码来源:Cache.php

示例6: connect

 /**
  * Try connect to memcache server
  */
 public static function connect()
 {
     if (!self::$connectTrying && class_exists('Memcache', false)) {
         self::$server = new Memcache();
         self::$connected = @self::$server->connect('localhost', 11211);
     }
     self::$connectTrying = true;
 }
开发者ID:krvd,项目名称:cms-Inji,代码行数:11,代码来源:Cache.php

示例7: __construct

 /**
  * 构造函数
  * @param string $host Redis 服务器的主机名或IP地址或者为服务器组相关信息
  * @param int $port 端口号
  * @param int $timeout 超时时间
  */
 private function __construct($host = 'localhost', $port = 11211, $timeout = 60)
 {
     $this->redis = new \redis();
     if (is_array($host)) {
         $this->redis->connect($host['host'], $host['port']);
     } else {
         $this->redis->connect($host, $port);
     }
 }
开发者ID:jc3wish,项目名称:xlogger,代码行数:15,代码来源:Redis.Cache.class.php

示例8: __construct

 /**
  *
  * @param Oops_Config $config
  */
 public function __construct($config)
 {
     $config = new Oops_Config(array('host' => 'localhost', 'port' => 11211, 'timeout' => 1));
     $this->_m = new Memcache();
     $this->_m->connect($config->host, $config->port, $config->timeout);
     if ($config->compress) {
         $this->_compress = MEMCACHE_COMPRESSED;
     }
 }
开发者ID:laiello,项目名称:oops-project,代码行数:13,代码来源:Memcache.php

示例9: open

 public function open($path = null, $name = null)
 {
     if (!class_exists('\\Memcache')) {
         throw new \RuntimeException("Use Session\\Memcache need memcache extension installed.");
     }
     $this->memcache = new \Memcache();
     $this->memcache->connect($this->injectors['host'], $this->injectors['port'], $this->injectors['timeout']);
     return true;
 }
开发者ID:pagon,项目名称:framework,代码行数:9,代码来源:Memcache.php

示例10: __construct

 public function __construct($host = 'localhost', $port = 11211, $prefix = '')
 {
     if (!self::isAvailable()) {
         throw new Exception("PHP extension 'memcache' is not loaded.");
     }
     $this->prefix = $prefix;
     $this->memcache = new Memcache();
     $this->memcache->connect($host, $port);
 }
开发者ID:romcok,项目名称:treeview,代码行数:9,代码来源:MemcachedStorage.php

示例11: getInstance

 /**
  * @return \Memcache
  */
 public function getInstance()
 {
     if (is_null($this->instance)) {
         $this->instance = new \Memcache();
         $this->instance->connect("localhost", 11211);
         return $this->instance;
     }
     return $this->instance;
 }
开发者ID:ovr,项目名称:cacher,代码行数:12,代码来源:Memcache.php

示例12: __construct

 /**
  * construct PhealMemcache,
  * @param array $options optional config array, valid keys are: host, port
  */
 public function __construct($options = array())
 {
     // add options
     if (is_array($options) && count($options)) {
         $this->options = array_merge($this->options, $options);
     }
     $this->memcache = new Memcache();
     $this->memcache->connect($this->options['host'], $this->options['port']);
 }
开发者ID:shibdib,项目名称:API-Registration-Mod-Revisited,代码行数:13,代码来源:PhealMemcache.php

示例13: __construct

 public function __construct($server = 'localhost', $port = 11211)
 {
     if (empty(self::$memcache)) {
         if (!class_exists('Memcache')) {
             throw new \Exception('You need to have the php memcached extension');
         }
         self::$memcache = new \Memcache();
         self::$memcache->connect($server, $port) or die("Could not connect");
     }
 }
开发者ID:emersonmatsumoto,项目名称:piwik,代码行数:10,代码来源:CacheMemcache.php

示例14: open

 /**
  * Open up the backend
  *
  * @param string $savePath
  * @param string $sessionName
  * @return boolean
  */
 public function open($savePath, $sessionName)
 {
     $this->_backend = new Memcache();
     // Open a persistent or regular connection
     if ($this->_config['persistent']) {
         $this->_backend->pconnect($this->_config['hostname'], $this->_config['port'], $this->_config['timeout_connect']);
     } else {
         $this->_backend->connect($this->_config['hostname'], $this->_config['port'], $this->_config['timeout_connect']);
     }
 }
开发者ID:rosstuck,项目名称:SessionHandler,代码行数:17,代码来源:Memcache.php

示例15: __construct

 /**
  * @param string $sHost = '127.0.0.1'
  * @param int $iPost = 11211
  * @param int $iExpire = 43200
  */
 private function __construct($sHost = '127.0.0.1', $iPost = 11211, $iExpire = 43200)
 {
     $this->sHost = $sHost;
     $this->iPost = $iPost;
     $this->iExpire = 0 < $iExpire ? $iExpire : 43200;
     $this->oMem = new \Memcache();
     if (!$this->oMem->connect($this->sHost, $this->iPost)) {
         $this->oMem = null;
     }
 }
开发者ID:BertLasker,项目名称:Catch-design,代码行数:15,代码来源:Memcache.php


注:本文中的Memcache::connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。