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


PHP Memcache::getServerStatus方法代码示例

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


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

示例1: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $gacela = \Gacela\Gacela::instance();
     $source = $gacela::createDataSource(array('type' => 'mysql', 'name' => 'db', 'user' => 'gacela', 'password' => 'gacela', 'schema' => 'gacela', 'host' => 'localhost'));
     $test = $gacela::createDataSource(array('type' => 'mysql', 'name' => 'test', 'user' => 'gacela', 'password' => 'gacela', 'schema' => 'test', 'host' => 'localhost'));
     $gacela->registerDataSource($source);
     $gacela->registerDataSource($test);
     $gacela->registerNamespace('App', __DIR__ . '/../samples/');
     $gacela->registerNamespace('Test', __DIR__ . '/Test');
     $this->object = $gacela;
     $this->memcache = new Memcache();
     if (!$this->memcache->addServer('127.0.0.1', 11211)) {
         throw new \Exception($this->memcache->getServerStatus());
     }
     if (is_object($this->memcache)) {
         $this->memcache->flush();
     }
 }
开发者ID:energylab,项目名称:gacela,代码行数:22,代码来源:GacelaTest.php

示例2: connect

/**
 * Connects to a server in connection pool
 *
 * @param string $host host ip address or name
 * @param integer $port Server port
 * @return boolean True if memcache server was connected
 */
	public function connect($host, $port = 11211) {
		if ($this->_Memcache->getServerStatus($host, $port) === 0) {
			if ($this->_Memcache->connect($host, $port)) {
				return true;
			}
			return false;
		}
		return true;
	}
开发者ID:hungnt88,项目名称:5stars-1,代码行数:16,代码来源:MemcacheEngine.php

示例3: _setUpCache

 private function _setUpCache()
 {
     $frontendOptions = array('lifetime' => 3600, 'automatic_serialization' => true);
     $backendOptions = array('file_name_prefix' => 'clearhealth', 'hashed_directory_level' => 1, 'cache_dir' => '/tmp/', 'hashed_directory_umask' => 0700);
     $cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
     Zend_Registry::set('cache', $cache);
     $cache = new Memcache();
     $cache->connect('127.0.0.1', 11211);
     $status = $cache->getServerStatus('127.0.0.1', 11211);
     if ($status === 0) {
         // memcache server failed, do error trapping?
     }
     Zend_Registry::set('memcache', $cache);
 }
开发者ID:psoas,项目名称:ch3-dev-preview,代码行数:14,代码来源:TestCase.php

示例4: offLogClient

echo "<br />Gearman installed in PHP - Success...";
unset($gearman);
/**
 * 1 & 2 - Include config file, create new client with config 
 */
include 'config/sharedconfig.php';
include 'offLogClient.php';
$loggingClient = new offLogClient($offLogCfg);
echo "<br />offLogClient - Success...";
/**
 * 3 - MySQL connection test
 */
$mysqli = new mysqli($offLogCfg['database']['host'], $offLogCfg['database']['user'], $offLogCfg['database']['pass'], $offLogCfg['database']['database']);
if (mysqli_connect_error()) {
    die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
}
echo "<br />MySQL - Success... {$mysqli->host_info}";
/**
 * 4 - Memcache connection test
 */
$memcache->addServer($offLogCfg['memcache']['ip'], $offLogCfg['memcache']['port']);
if (!$memcache->getServerStatus($offLogCfg['memcache']['ip'], $offLogCfg['memcache']['port'])) {
    die("Connection to memcache failed, is it isntalled and running ?");
}
echo "<br />Memcache connection - Success... ";
/**
 * 5 - Fire off logging action 1, userid 1, payload "test string"
 */
echo "<br />" . $loggingClient->logSimpleAction(1, ACTION_USER_LOGON, 'test string');
echo "<br />logSimpleAction";
echo "<br />Done - tests complete";
开发者ID:JeremyHutchings,项目名称:OffLog,代码行数:31,代码来源:test.php

示例5: array

$tbl->addHeaderCell($this->objLanguage->languageText("mod_cache_stats", "cache"));
$tbl->addHeaderCell('');
$tbl->endHeaderRow();
if (!isset($cache)) {
    $cache = array();
}
foreach ($cache as $servers) {
    // grab an edit and delete icon
    $edIcon = $this->objIcon->getEditIcon($this->uri(array('action' => 'editserver', 'id' => $servers['ip'] . ":" . $servers['port'], 'module' => 'cache')));
    $delIcon = $this->objIcon->getDeleteIconWithConfirm($servers['ip'], array('module' => 'cache', 'action' => 'deleteserver', 'id' => $servers['ip'] . ":" . $servers['port']), 'cache');
    $yesIcon = $this->objIcon->setIcon('greentick');
    $yesIcon = $this->objIcon->show();
    $noIcon = $this->objIcon->setIcon('redcross');
    $noIcon = $this->objIcon->show();
    $memcache->addServer($servers['ip'], $servers['port']);
    if ($memcache->getServerStatus($servers['ip'], $servers['port']) != 0) {
        $status = $yesIcon;
    } else {
        $status = $noIcon;
    }
    $extStatsLink = new href($this->uri(array('action' => 'displaystats', 'id' => $servers['ip'] . ":" . $servers['port']), 'cache'), $this->objLanguage->languageText("mod_cache_viewstats", "cache"));
    $tbl->startRow();
    $tbl->addCell($servers['ip']);
    $tbl->addCell($servers['port']);
    // get a status icon and show it here
    $tbl->addCell($status);
    // get a stats icon
    $tbl->addCell($extStatsLink->show());
    // edit/delete option...
    $tbl->addCell('');
    //$edIcon.$delIcon);
开发者ID:ookwudili,项目名称:chisimba,代码行数:31,代码来源:edit_tpl.php

示例6: array

/**
 * WebVista
 */
require_once 'WebVista/App.php';
/**
 * Zend_Loader
 */
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoLoad();
$frontendOptions = array('lifetime' => 3600, 'automatic_serialization' => true);
$backendOptions = array('file_name_prefix' => 'clearhealth', 'hashed_directory_level' => 1, 'cache_dir' => '/tmp/', 'hashed_directory_umask' => 0700);
$cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
Zend_Registry::set('cache', $cache);
$cache = new Memcache();
$cache->connect('127.0.0.1', 11211);
$status = $cache->getServerStatus('127.0.0.1', 11211);
if ($status === 0) {
    // memcache server failed, do error trapping?
}
Zend_Registry::set('memcache', $cache);
$config = new Zend_Config_Ini($chAppPath . "/config/app.ini", TESTS_APPLICATION_ENVIRONMENT);
Zend_Registry::set('config', $config);
try {
    $dbAdapter = Zend_Db::factory(Zend_Registry::get('config')->database);
    $dbAdapter->query("SET NAMES 'utf8'");
} catch (Zend_Exception $e) {
    die($e->getMessage());
}
Zend_Db_Table_Abstract::setDefaultAdapter($dbAdapter);
Zend_Registry::set('dbAdapter', $dbAdapter);
unset($chRoot, $chAppPath, $chLibraryPath, $chModelsPath, $chTestsPath, $path);
开发者ID:psoas,项目名称:ch3-dev-preview,代码行数:31,代码来源:TestHelper.php

示例7: _setupCache

 protected function _setupCache()
 {
     /*
             $frontendOptions = array('lifetime' => 3600, 'automatic_serialization' => true);
             $backendOptions = array('servers' => array('host' => '127.0.0.1', 'port' => 11211, 'persistent' => true));
             $cache = Zend_Cache::factory('Core', 'Memcached', $frontendOptions, $backendOptions);
             Zend_Registry::set('memcache', $cache);
     */
     $frontendOptions = array('lifetime' => 3600, 'automatic_serialization' => true);
     $backendOptions = array('file_name_prefix' => 'clearhealth', 'hashed_directory_level' => 1, 'cache_dir' => '/tmp/', 'hashed_directory_umask' => 0700);
     $cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
     Zend_Registry::set('cache', $cache);
     $memcache = new Memcache();
     $memcache->connect('127.0.0.1', 11211);
     $status = $memcache->getServerStatus('127.0.0.1', 11211);
     if ($status === 0) {
         // memcache server failed, do error trapping?
     }
     Zend_Registry::set('memcache', $memcache);
     Zend_Registry::set('memcacheStatus', $status);
     return $this;
 }
开发者ID:jakedorst,项目名称:ch3-dev-preview,代码行数:22,代码来源:App.php


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