packageredisimport("context""fmt""strconv""github.com/go-redis/redis/v8""gitlab.fjmaimaimai.com/allied-creation/performance/pkg/constant")varrdb*redis.Clientfuncinit(){host:=constant.REDIS_HOSTport:=constant.REDIS_PORTauth:=constant.REDIS_AUTHindex:=0ifconstant.REDIS_DB!=""{indexDb:=constant.REDIS_DBindex,_=strconv.Atoi(indexDb)}rdb=redis.NewClient(&redis.Options{Addr:fmt.Sprintf("%v:%v",host,port),Password:auth,DB:index,// use default DB})res:=rdb.Ping(context.TODO())ifres.Err()!=nil{panic("redis not found")}}funcGetRDB()*redis.Client{returnrdb}