本文整理匯總了PHP中Memcached::close方法的典型用法代碼示例。如果您正苦於以下問題:PHP Memcached::close方法的具體用法?PHP Memcached::close怎麽用?PHP Memcached::close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Memcached
的用法示例。
在下文中一共展示了Memcached::close方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: close
public function close()
{
$this->gc(ini_get('session.gc_maxlifetime'));
$this->handle->close();
$this->handle = null;
return true;
}
示例2: _after
public function _after(TestCase $test)
{
$this->memcache->flush();
switch (get_class($this->memcache)) {
case 'Memcache':
$this->memcache->close();
break;
case 'Memcached':
$this->memcache->quit();
break;
}
}
示例3: _before
public function _before(\Codeception\TestCase $test)
{
if (class_exists('\\Memcache')) {
$this->memcache = new \Memcache();
$this->memcache->close();
$this->memcache->connect($this->config['host'], $this->config['port']);
} elseif (class_exists('\\Memcached')) {
$this->memcache = new \Memcached();
$this->memcache->addServer($this->config['host'], $this->config['port']);
} else {
throw new \Codeception\Exception\ModuleConfig(__CLASS__, 'Memcache classes not loaded');
}
}
示例4: __destruct
/**
* Destroy the connections.
*/
public function __destruct()
{
switch (NN_CACHE_TYPE) {
case self::TYPE_REDIS:
$this->server->close();
break;
case self::TYPE_MEMCACHED:
$this->server->quit();
break;
}
}
示例5: close
/**
* Close
*
* Releases locks and closes connection.
*
* @return void
*/
public function close()
{
if (isset($this->_memcached)) {
isset($this->_lock_key) && $this->_memcached->delete($this->_lock_key);
if (!$this->_memcached->close()) {
return FALSE;
}
$this->_memcached = NULL;
return TRUE;
}
return FALSE;
}
示例6: __destruct
/**
* Destructor
*
* @access public
* @result void
*/
public function __destruct()
{
if ($this->driver) {
$this->driver->close();
}
}
示例7: disconnect
/**
* Disconnect from the cache
*/
function disconnect()
{
@$this->memcached->close();
}
示例8: Memcached
<?php
/**
* Created by PhpStorm.
* User: shaoting
* Date: 15/7/25
* Time: 下午2:49
*/
//
//
$connect = new Memcached();
//聲明一個新的memcached鏈接
$connect->setOption(Memcached::OPT_COMPRESSION, false);
//關閉壓縮功能
$connect->setOption(Memcached::OPT_BINARY_PROTOCOL, true);
//使用binary二進製協議
$connect->addServer('7e3d812f3aa14d09.m.cnhzaliqshpub001.ocs.aliyuncs.com', 11211);
//添加OCS實例地址及端口號
$connect->setSaslAuthData('7e3d812f3aa14d09', 'Aliyun6161361');
//設置OCS帳號密碼進行鑒權,如已開啟免密碼功能,則無需此步驟
echo "dsf" . $connect->get(11223);
$connect->close();