123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace App\Com;
- use EasySwoole\EasySwoole\Config;
- use EasySwoole\Redis\Config\RedisConfig;
- class Redis
- {
- private static $instance;
- protected $connect; //Redis连接实例
- static function getInstance(){
- if(!isset(self::$instance)){
- self::$instance = new static();
- }
- return self::$instance;
- }
- function __construct()
- {
- $db_config = Config::getInstance()->getConf('REDIS');
- $config = new RedisConfig($db_config);
- $this->connect = new \EasySwoole\Redis\Redis($config);
- // $this->connect->connect($db_config['host'], $db_config['port']); //连接Redis
- // $this->connect->auth($db_config['auth']); //密码验证
- }
- public function getConnect(){
- return $this->connect;
- }
- public function get($key) {
- }
- }
|