jokes-bapak2/api/app/v1/platform/cache/redis.go

20 lines
300 B
Go
Raw Normal View History

2021-07-09 06:11:11 +00:00
package cache
import (
"log"
"os"
"github.com/go-redis/redis/v8"
2021-07-09 12:13:19 +00:00
_ "github.com/joho/godotenv/autoload"
2021-07-09 06:11:11 +00:00
)
// Connect to the database
func New() *redis.Client {
opt, err := redis.ParseURL(os.Getenv("REDIS_URL"))
if err != nil {
log.Fatalln(err)
}
rdb := redis.NewClient(opt)
return rdb
}