package service

import (
	"fmt"

	"github.com/astaxie/beego"
	"github.com/go-redis/redis"
)

func RedisClient() *redis.Client {
	address := fmt.Sprintf("%s:%s", beego.AppConfig.String("redishost"), beego.AppConfig.String("redisport"))
	client := redis.NewClient(&redis.Options{
		Addr:     address,
		Password: beego.AppConfig.String("redispasswrod"), // no password set
		DB:       0,                                       // use default DB
	})
	pong, err := client.Ping().Result()
	fmt.Println(pong, err)
	return client
}
