12345678910111213141516171819202122232425262728293031323334 |
- <?php
- namespace App\Com;
- use EasySwoole\EasySwoole\Config;
- 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');
- $this->connect = new \Redis();
- $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) {
- }
- }
|