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


PHP Redis::close方法代码示例

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


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

示例1: close

 /**
  * Отключение от Redis.
  * 
  * @return void
  * @access public
  * @static
  */
 public static function close()
 {
     if (static::$redis) {
         static::$redis->close();
         static::$redis = null;
     }
 }
开发者ID:Ganzal,项目名称:php-pinger-service,代码行数:14,代码来源:RKS.php

示例2: __destruct

 public function __destruct()
 {
     // TODO: Implement __destruct() method.
     if (isset($this->redis) && $this->redis instanceof Redis) {
         $this->redis->close();
     }
 }
开发者ID:xidiao,项目名称:gxfenxi,代码行数:7,代码来源:RedisHandler.php

示例3: tearDown

 public function tearDown()
 {
     if ($this->redis) {
         $this->redis->close();
     }
     //     unset($this->redis);
 }
开发者ID:stonegithubs,项目名称:phpredis,代码行数:7,代码来源:TestRedis.php

示例4: __destruct

 public function __destruct()
 {
     if ($this->instance) {
         $this->instance->close();
         unset($this->instance);
     }
 }
开发者ID:ovr,项目名称:cacher,代码行数:7,代码来源:Redis.php

示例5: tearDownAfterClass

 public static function tearDownAfterClass()
 {
     parent::tearDownAfterClass();
     self::clear(self::$conn);
     self::$conn->close();
     self::$conn = null;
 }
开发者ID:rybakit,项目名称:taskqueue,代码行数:7,代码来源:RedisQueueTest.php

示例6: connect

 /**
  * connect to redis server
  * 
  * @param string $host
  * @param integer $port
  * @param integer $timeout
  * @throws Tinebase_Exception_Backend
  */
 public function connect($host = null, $port = null, $timeout = null)
 {
     if ($this->_redis instanceof Redis) {
         $this->_redis->close();
     }
     $host = $host ? $host : $this->_options['host'];
     $port = $port ? $port : $this->_options['port'];
     $timeout = $timeout ? $timeout : $this->_options['timeout'];
     $this->_redis = new Redis();
     if (!$this->_redis->connect($host, $port, $timeout)) {
         throw new Tinebase_Exception_Backend('Could not connect to redis server at ' . $host);
     }
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:21,代码来源:Redis.php

示例7: initModules

function initModules($application)
{
    $redis = new Redis();
    $redis->connect(CACHE_HOSTNAME, CACHE_PORT);
    $redis->select(CACHE_DB);
    $modulesKey = $application . '-modules';
    $modules = $redis->get($modulesKey);
    if (empty($modules)) {
        $modules = [];
        $dir = __DIR__ . '/../../' . $application . '/modules';
        $dirpath = realpath($dir);
        $filenames = scandir($dir);
        foreach ($filenames as $filename) {
            if ($filename == '.' || $filename == '..') {
                continue;
            }
            if (is_file($dirpath . DIRECTORY_SEPARATOR . $filename . '/Module.php')) {
                $modules[strtolower($filename)] = ['class' => $application . '\\modules\\' . $filename . '\\Module'];
            }
        }
        $redis->set($modulesKey, serialize([$modules, null]));
    } else {
        $modules = unserialize($modules);
        if (!empty($modules[0])) {
            $modules = $modules[0];
        }
    }
    $redis->close();
    return $modules;
}
开发者ID:timelessmemory,项目名称:uhkklp,代码行数:30,代码来源:modules.php

示例8: __destruct

	public function __destruct() {
		try {
			if ($this->_redis) {
				$this->_redis->close();
			}
		} catch (Exception $e) {}
	}
开发者ID:neil-chen,项目名称:NeilChen,代码行数:7,代码来源:RedisCache.class.php

示例9: finish

 /**
  * {@inheritDoc}
  * @see \Mcustiel\SimpleCache\Interfaces\CacheInterface::finish()
  */
 public function finish()
 {
     if ($this->connection !== null) {
         $this->connection->close();
         $this->connection = null;
     }
 }
开发者ID:mcustiel,项目名称:php-simple-cache,代码行数:11,代码来源:Cache.php

示例10: process

 public function process()
 {
     $this->params['output'] = 'json';
     $context = \CADB\Model\Context::instance();
     if (!($rdb = $context->getProperty('service.redis'))) {
         $this->result = array('found' => false, 'error' => "자동완성 기능이 활성화되어 있지 않습니다.");
     } else {
         if (!$this->params['q']) {
             $this->result = array('found' => false, 'error' => "자동완성할 키워드를 입력하세요.");
         } else {
             $redis = new \Redis();
             try {
                 $redis->connect('127.0.0.1', '6379', 2.5, NULL, 150);
                 if ($redis->select($rdb) == false) {
                     $this->result = array('found' => false, 'error' => "index 1 database 에 연결할 수 없습니다.");
                 } else {
                     $this->recommand = $redis->zRange($this->params['q'], 0, -1);
                     if (@count($this->recommand)) {
                         $this->result = array('found' => true, 'total_cnt' => @count($this->recommand));
                     } else {
                         $this->result = array('found' => true, 'total_cnt' => 0);
                     }
                 }
             } catch (RedisException $e) {
                 var_dump($e);
             }
             $redis->close();
         }
     }
 }
开发者ID:jinbonetwork,项目名称:collective-agreement-database,代码行数:30,代码来源:autocomplete.php

示例11: close

 /**
  *
  */
 public function close()
 {
     if ($this->_socket) {
         $this->_socket->close();
         $this->_socket = null;
     }
 }
开发者ID:insolita,项目名称:yii2-redisman,代码行数:10,代码来源:PhpredisConnection.php

示例12: __destruct

 /**
  * Class destructor
  *
  * Closes the connection to Redis if present.
  *
  * @return	void
  */
 public function __destruct()
 {
     //        if ($this->_redis && $this->is_supported())
     if ($this->_redis) {
         $this->_redis->close();
     }
 }
开发者ID:TimHuangcheng,项目名称:CI,代码行数:14,代码来源:Cache_redis.php

示例13: close

 /**
  * Closes a connection.
  *
  * @return bool Always true
  */
 public function close()
 {
     if ($this->isConnected()) {
         $this->_connection->close();
     }
     $this->connected = false;
     $this->_connection = null;
     return true;
 }
开发者ID:oefenweb,项目名称:cakephp-redis,代码行数:14,代码来源:RedisSource.php

示例14: srvc_redis_dump_info

function srvc_redis_dump_info()
{
    // https://github.com/phpredis/phpredis#close
    $redis = new Redis();
    $redis->connect('127.0.0.1');
    $redis_info = $redis->info();
    $redis->close();
    $json = json_encode($redis_info);
    echo "{$json}";
}
开发者ID:henern,项目名称:too_studio_wx,代码行数:10,代码来源:srvc_redis_api.php

示例15: close

 public function close()
 {
     if ($this->_connected) {
         try {
             $this->_redis->close();
         } catch (Exception $e) {
         }
         $this->_connected = false;
     }
 }
开发者ID:shtrihstr,项目名称:redis-object-cache,代码行数:10,代码来源:object-cache.php


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