當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Memcached::__construct方法代碼示例

本文整理匯總了PHP中Memcached::__construct方法的典型用法代碼示例。如果您正苦於以下問題:PHP Memcached::__construct方法的具體用法?PHP Memcached::__construct怎麽用?PHP Memcached::__construct使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Memcached的用法示例。


在下文中一共展示了Memcached::__construct方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 public function __construct($serverName = null)
 {
     if ($serverName != null) {
         $this->server = $serverName;
     }
     parent::__construct();
 }
開發者ID:jkhaled,項目名稱:bms,代碼行數:7,代碼來源:MyCache.php

示例2:

 function __construct()
 {
     parent::__construct();
     $_conf = Vera_Conf::getConf('memcached');
     $this->_connect($_conf['host'], $_conf['port']);
     self::$conf = $_conf;
 }
開發者ID:HackathonTsubaki,項目名稱:Backend,代碼行數:7,代碼來源:Cache.php

示例3: __construct

 public function __construct()
 {
     parent::__construct('internal.makerspace.se');
     // Do NOT spawn millions of connections...
     if (!count($this->getServerList())) {
         parent::addServer('127.0.0.1', 11211);
     }
 }
開發者ID:johusman,項目名稱:internal,代碼行數:8,代碼來源:Memcache.php

示例4: __construct

 public function __construct(&$system)
 {
     parent::__construct();
     $cfg = explode(':', __CFG::MEMCACHE);
     if ($this->addServer($cfg[0], $cfg[1])) {
         trigger_error('Connect Mcache Server Fail!', E_USER_ERROR);
     }
 }
開發者ID:a195474368,項目名稱:ejiawang,代碼行數:8,代碼來源:mcached.mdl.php

示例5: __construct

 public function __construct($host, $port, $id = 'story_pool')
 {
     parent::__construct($id);
     if (!parent::addServer($host, $port)) {
         throw new Exception("Could not connect memcached server {$host}:{$port}." . "\n" . 'Error code: ' . parent::getResultCode() . "\n" . ' Error message: ' . parent::getResultMessage());
     }
     parent::setOption(Memcached::OPT_BINARY_PROTOCOL, true);
 }
開發者ID:aprikyblue,項目名稱:PHP-Conditional-Reverse-Proxy,代碼行數:8,代碼來源:gateway_memcached.php

示例6: __construct

 /**
  * Construct
  * @param array $options the config options
  */
 public function __construct(array $options = [])
 {
     // call the parent with the cache pool name
     parent::__construct(self::MEMCACHED_POOL);
     // add the memcache server pool
     if (!$this->getServerList() && isset($options['memcached']['server'])) {
         $this->set_server_pool($options['memcached']['server']);
     }
 }
開發者ID:stevevega,項目名稱:kima,代碼行數:13,代碼來源:Memcached.php

示例7: __construct

 public function __construct()
 {
     parent::__construct();
     $cfg = explode(':', __CFG::MEMCACHE);
     if (!$this->addServer($cfg[0], $cfg[1])) {
         trigger_error('Memcache Connect Fail', E_USER_ERROR);
     } else {
         $this->prefix();
     }
 }
開發者ID:a195474368,項目名稱:ejiawang,代碼行數:10,代碼來源:memcached.mdl.php

示例8: __construct

 public function __construct($persistent_id = 'xxam', $server_host = 'localhost', $server_port = 11211, $options = array())
 {
     $this->persistent_id = $persistent_id;
     $this->server_host = $server_host;
     $this->server_port = $server_port;
     $this->options = $options;
     parent::__construct($persistent_id);
     $this->addServer($this->server_host, $this->server_port);
     $this->setOptions($this->options);
 }
開發者ID:julianstricker,項目名稱:xxam,代碼行數:10,代碼來源:MemcachedService.php

示例9: __construct

 public function __construct($config)
 {
     if (!extension_loaded('memcached')) {
         die('Memcached extension that required by Driver memcached is not available.');
     }
     parent::__construct();
     foreach ($config['server'] as $server) {
         $this->addServer($server['host'], $server['port'], $server['persistent']);
     }
 }
開發者ID:finzaiko,項目名稱:Panada,代碼行數:10,代碼來源:Memcached.php

示例10: __construct

 public function __construct($host = Memcached::DEFAULT_HOST, $port = Memcached::DEFAULT_PORT, $buffer = Memcached::DEFAULT_BUFFER)
 {
     if (PinbaClient::isEnabled()) {
         PinbaClient::me()->timerStart('memcached_' . $host . '_' . $port . '_connect', array('memcached_connect' => $host . '_' . $port));
     }
     parent::__construct($host, $port, $buffer);
     if (PinbaClient::isEnabled()) {
         PinbaClient::me()->timerStop('memcached_' . $host . '_' . $port . '_connect');
     }
 }
開發者ID:rero26,項目名稱:onphp-framework,代碼行數:10,代碼來源:PinbedMemcached.class.php

示例11: __construct

 /**
  * @inheritdoc
  * @codeCoverageIgnore
  */
 public function __construct($prefix = '', $host = 'localhost', $port = 11211, $persistent_id = null)
 {
     parent::__construct($persistent_id);
     $this->host = $host;
     $this->port = 11211;
     $this->addServer($this->host, $this->port);
     $this->prefix = $prefix;
     if (empty($prefix)) {
         $this->prefix = (string) rand(100, 999);
     }
 }
開發者ID:jonafrank,項目名稱:memcached-manager,代碼行數:15,代碼來源:MemcachedHandler.php

示例12:

 /**
  * KitMemcached Constructor
  * @param                    $key_prefix
  * @param MemcachedConnector $connector
  * @internal param bool        $safemode
  * @return \Kit\DB\Memcached\Memcached
  */
 function __construct($key_prefix, MemcachedConnector $connector)
 {
     // Construct parent
     parent::__construct();
     // Set param prefix
     self::$_prefix = crc32($key_prefix);
     // Inst: Object Connector class
     self::$_instConnector = $connector;
     // Void: Apply Connector container to base Memcached
     $this->applyConnector($this, self::$_instConnector);
     // set the key prefix.
     $this->setOptions(array(self::OPT_PREFIX_KEY => self::$_prefix));
 }
開發者ID:t4g,項目名稱:kit-memcached,代碼行數:20,代碼來源:Memcached.php

示例13: die

 /**
  * Конструктор. Подключается к серваку мемкэша
  * 
  */
 function __construct()
 {
     parent::__construct();
     if (!($server = $GLOBALS['memcachedSessionServer'])) {
         // В /classes/config.php добавляем:
         // $memcachedSessionServer = 'localhost';
         if (!($server = $GLOBALS['memcachedServers'][0])) {
             die('Не найдены сервера Memcached');
         }
     }
     $this->bIsConnected = $this->addServer($server, 11211);
     $this->setOption(self::OPT_PREFIX_KEY, SERVER);
     $this->_log = new log('sessions/error-%d%m%Y.log', 'a');
 }
開發者ID:Nikitian,項目名稱:fl-ru-damp,代碼行數:18,代碼來源:session_Memcached.php

示例14:

 function __construct($persistent_id = null)
 {
     if (is_null($persistent_id)) {
         parent::__construct();
         $this->setOption(\Memcached::OPT_LIBKETAMA_COMPATIBLE, true);
         if (!count($this->getServerList())) {
             $this->addServers(\config\Conf::$memcachedserver);
         }
     } else {
         parent::__construct($persistent_id);
         $this->setOption(\Memcached::OPT_PREFIX_KEY, $persistent_id);
         $this->setOption(\Memcached::OPT_LIBKETAMA_COMPATIBLE, true);
         if (!count($this->getServerList())) {
             $this->addServers(\config\Conf::$memcachedserver);
         }
     }
 }
開發者ID:CamTosh,項目名稱:Mediastorrent,代碼行數:17,代碼來源:Memcached.php

示例15: __construct

 public function __construct($persistentId = '-')
 {
     parent::__construct($persistentId);
     $serverList = $this->getServerList();
     if (empty($serverList)) {
         $this->setOption(\Memcached::OPT_PREFIX_KEY, 'sndsgd-');
         $this->setOption(\Memcached::OPT_RECV_TIMEOUT, 1000);
         $this->setOption(\Memcached::OPT_SEND_TIMEOUT, 1000);
         $this->setOption(\Memcached::OPT_TCP_NODELAY, true);
         $this->setOption(\Memcached::OPT_SERVER_FAILURE_LIMIT, 50);
         $this->setOption(\Memcached::OPT_CONNECT_TIMEOUT, 500);
         $this->setOption(\Memcached::OPT_RETRY_TIMEOUT, 300);
         $this->setOption(\Memcached::OPT_REMOVE_FAILED_SERVERS, true);
         $this->setOption(\Memcached::OPT_LIBKETAMA_COMPATIBLE, true);
         $this->addServer('127.0.0.1', 11211, 1);
     }
 }
開發者ID:GenomeUS,項目名稱:sndsgd-util,代碼行數:17,代碼來源:Memcached.php


注:本文中的Memcached::__construct方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。