Beispiel #1
0
 /**
  * 初始化Redis连接
  *
  * @throws RedisException
  */
 private static function initRedis()
 {
     $apf = APF::get_instance();
     $config = $apf->get_config('mobile_customer', 'redis');
     if (!isset($config['host']) || !isset($config['port'])) {
         throw new RedisException('Host and port are needed to connect redis server.');
     }
     self::$redis = new Redis();
     if (!self::$redis->connect($config['host'], $config['port'])) {
         throw new RedisException("Failed to connect redis server: {$config['host']}:{$config['port']}");
     }
 }