19 lines
309 B
Go
19 lines
309 B
Go
package database
|
|
|
|
import (
|
|
"context"
|
|
|
|
"a301_server/pkg/config"
|
|
"github.com/redis/go-redis/v9"
|
|
)
|
|
|
|
var RDB *redis.Client
|
|
|
|
func ConnectRedis() error {
|
|
RDB = redis.NewClient(&redis.Options{
|
|
Addr: config.C.RedisAddr,
|
|
Password: config.C.RedisPassword,
|
|
})
|
|
return RDB.Ping(context.Background()).Err()
|
|
}
|