求教:redis在tp中可以不new吗

浏览:590 发布日期:2017/08/16 分类:求助交流
我暂时把redis的实例化放在common.php中,代码如下:
$this->redis = new \Redis();
$this->redis->pconnect(config('redis_host'), config('port'));
$this->redis->auth(config('redis_auth'));

但每个访问都要new一下,我担心内存消耗太大。
请问:有没可能改用static方法?或者减少new的次数?如何实现?
最佳答案
评论( 相关
后面还有条评论,点击查看>>