當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。