Ejemplo n.º 1
0
 public function close()
 {
     $this->gc(ini_get('session.gc_maxlifetime'));
     $this->handle->close();
     $this->handle = null;
     return true;
 }
Ejemplo n.º 2
0
 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;
     }
 }
Ejemplo n.º 3
0
 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');
     }
 }
Ejemplo n.º 4
0
 /**
  * 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;
     }
 }
 /**
  * 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;
 }
Ejemplo n.º 6
0
 /**
  * Destructor
  *
  * @access public
  * @result void
  */
 public function __destruct()
 {
     if ($this->driver) {
         $this->driver->close();
     }
 }
Ejemplo n.º 7
0
 /**
  * Disconnect from the cache
  */
 function disconnect()
 {
     @$this->memcached->close();
 }
Ejemplo n.º 8
0
<?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();