美文网首页
thinkphp5.0 redis 配置账号密码使用

thinkphp5.0 redis 配置账号密码使用

作者: someonemaybe | 来源:发表于2019-01-23 17:20 被阅读0次

    class Redis

    {

        static private $instance;

        private function __construct()

    {

    }

        static public function getInstance()

    {

            if (!self::$instance instanceof self){

                self::$instance = (new \think\cache\driver\Redis([

                    'host'      => config('cache.host'),

                    'port'      => config('cache.port'),

                    'password'  => config('cache.password'),

                    'select'    => 0,

                    'timeout'    => 0,

                    'expire'    => 0,

                    'persistent' => false,

                    'prefix'    => '',

    ]))->handler();

    }

            return self::$instance;

    }

        private function __clone()

    {

    }

    }

    相关文章

      网友评论

          本文标题:thinkphp5.0 redis 配置账号密码使用

          本文链接:https://www.haomeiwen.com/subject/pyrsjqtx.html