本文整理汇总了PHP中Memcache::close方法的典型用法代码示例。如果您正苦于以下问题:PHP Memcache::close方法的具体用法?PHP Memcache::close怎么用?PHP Memcache::close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Memcache
的用法示例。
在下文中一共展示了Memcache::close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: csvDataToMemcache
function csvDataToMemcache($csvList, $csvDir, $memIP, $memPort)
{
$memcached = new Memcache();
$memcached->connect($memIP, $memPort);
foreach ($csvList as $key => $value) {
$csvObj = new parseCSV();
$csvObj->auto($csvDir . '/' . $value);
list($fileName, $fileType) = explode('.', $value);
$memcached->set($fileName, $csvObj->data, MEMCACHE_COMPRESSED, 0);
//debug info
//echo "<br/>--------------------------------------------$fileName.csv to memcache-------------------------------------------<br/>";
print_r($memcached->get($fileName));
}
$memcached->close();
echo "success";
}
示例2: close
/**
* Close the backend
*
* @return boolean
*/
public function close()
{
if (is_object($this->_backend)) {
return $this->_backend->close();
}
return false;
}
示例3: __destruct
public function __destruct()
{
if ($this->instance) {
$this->instance->close();
unset($this->instance);
}
}
示例4: close
public function close()
{
$this->gc(ini_get('session.gc_maxlifetime'));
$this->handle->close();
$this->handle = null;
return true;
}
示例5: finish
/**
* {@inheritDoc}
* @see \Mcustiel\SimpleCache\Interfaces\CacheInterface::finish()
*/
public function finish()
{
if ($this->connection !== null) {
$this->connection->close();
$this->connection = null;
}
}
示例6: disconnect
function disconnect()
{
if ($this->connected) {
$this->connected = false;
return $this->cache->close();
}
return true;
}
示例7: disconnect
/**
* Disconnect the open connection
*
* @return static
*
* @throws ConnectionException
*/
public function disconnect()
{
if ($this->_connection !== null) {
$this->_connection->close();
}
$this->_connection = null;
return $this;
}
示例8: __destruct
public function __destruct()
{
if (isset($this->memcache)) {
$this->memcache->close();
$this->memcache = NULL;
}
parent::__destruct();
}
示例9: __destruct
public function __destruct()
{
if ($this->alive) {
try {
$this->instance->close();
} catch (BaseException $e) {
// shhhh.
}
}
}
示例10: __destruct
/**
* Destructor
*
* @return void
*/
public function __destruct()
{
if ($this->_cache instanceof \Memcache) {
$this->_cache->close();
}
if (is_resource($this->_socket)) {
$cmd = 'quit' . self::EOL;
fwrite($this->_socket, $cmd);
fclose($this->_socket);
}
}
示例11: _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;
}
}
示例12: close
public static function close()
{
//already Closed Resource
if (!self::$_Connection instanceof Memcache) {
return;
}
self::$_Connection->close();
foreach (self::$_MemCachePool as $key => $_host) {
unset(self::$_MemCachePool[$key]);
}
self::$_Connection = null;
self::$_INSTANCE = null;
}
示例13: _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');
}
}
示例14: close
/**
* Close connection to memcache server
*
* @return bool
*/
protected function close()
{
if (!$this->is_connected) {
return false;
}
return $this->memcache->close();
}
示例15: getStatsFromCache
function getStatsFromCache($type = 'sizes', $slabib = null, $limit = 100)
{
$ini = parse_ini_file('scielo.def', true);
$memcache = new Memcache();
$memcache->connect($ini['CACHE']['SERVER_CACHE'], $ini['CACHE']['SERVER_PORT_CACHE']);
if ($slabib != null) {
$arr = $memcache->getExtendedStats($type, $slabid, $limit);
} else {
$arr = $memcache->getExtendedStats($type);
}
$saida = '';
$arr = array_pop($arr);
$saida .= '<table border="1">';
foreach ($arr as $key => $value) {
$saida .= '<tr>';
$saida .= '<td>' . $key . '</td>';
if (is_array($value)) {
$saida .= '<td><table border="1">';
foreach ($value as $k => $v) {
$saida .= '<tr>';
$saida .= '<td>' . $k . '</td>';
$saida .= '<td>' . $v . '</td>';
$saida .= '</tr>';
}
$saida .= '</table></td>';
} else {
$saida .= '<td>' . $value . '</td>';
}
$saida .= '</tr>';
}
$saida .= '</table>';
$memcache->close();
return $saida;
}