为了账号安全,请及时绑定邮箱和手机立即绑定

PHP使用redis需要封装一个类吗?

PHP使用redis需要封装一个类吗?

繁星淼淼 2019-05-25 14:01:16
1.首先想问一下一台redis服务器上有不同的项目,需要给redis的key加项目的前缀吗?还是用select不同数据库就好了?有12个可选2.之前使用redis也只是简单封装了一下而已,就直接调用原生的redis接口,这样足够了吗?$func=$options['persistent']?'pconnect':'connect';$this->handler=new\Redis;$options['timeout']===false?$this->handler->$func($options['host'],$options['port']):$this->handler->$func($options['host'],$options['port'],$options['timeout']);$options['auth']===false?'':$this->handler->auth($options['auth']);$this->handler->select($options['select']);return$this->handler;
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 302 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号