zoukankan      html  css  js  c++  java
  • PHP函数查看redis 版本号

    $redis_ext_refc = new ReflectionExtension('redis');
    var_dump($redis_ext_refc->getVersion());

    参考:

    public function addServer($host = '127.0.0.1', $port = 6379, $dbIndex = 0, $weight = 1) {
    		$redis = new Redis();
            $rhost = $host . ':' . $port;
    		$connection_string = $rhost . '/' . $dbIndex;
    
            $redis_ext_refc = new ReflectionExtension('redis');
            if (version_compare($redis_ext_refc->getVersion(), '2.1.0') <= 0) {
                $bret = $redis->pconnect($host, $port, 0);
            } else {
                $bret = $redis->pconnect($host, $port, 0, $connection_string);
            }
    
            if ($bret) {
    			// $redis->select($dbIndex); // redis-proxy and high redis not support this anymore
                $this->_hash->addTarget($rhost);
                $this->_pool[$rhost] = $redis;
                return true;
            }
    		unset($redis);
            return false;
        }

  • 相关阅读:
    poj 2391 Ombrophobic Bovines
    混合欧拉回路poj 1637 Sightseeing tour
    POJ1149-PIGS
    C
    B
    A
    C
    B
    A
    O
  • 原文地址:https://www.cnblogs.com/lxwphp/p/15847712.html
Copyright © 2011-2022 走看看