Redis

优质
小牛编辑
127浏览
2023-12-01

修改 apps/configs/redis.php ,加入配置。

$redis['master'] = array(
    'host' => '172.19.104.157',
    'port' => 6379, //默认为6379
    //'database' => 16, //数据库ID,可选
);
  • 默认取master项作为redis配置,$this->redis->get($key),框架会读取$this->config['redis']['master']作为配置
  • 使用$this->redis('master2')->get($key)实现多实例访问,框架会读取$this->config['redis']['master2']作为配置