use think\Cache;
//redis对象
public function getRedis()
{
$options = [
'type' => 'redis',//指定类型
'password'=>'asdfghjkl',
'prefix' => 'sbn-',
'host' => '127.0.0.1',
];
$redis = Cache::init($options);
return $redis;
}