Chore: project init
This commit is contained in:
18
pkg/database/redis.go
Normal file
18
pkg/database/redis.go
Normal file
@@ -0,0 +1,18 @@
|
||||
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()
|
||||
}
|
||||
Reference in New Issue
Block a user