本文整理汇总了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();