26 lines
367 B
Go
26 lines
367 B
Go
package rds
|
|
|
|
import (
|
|
"net"
|
|
"platform/pkg/env"
|
|
|
|
"github.com/redis/go-redis/v9"
|
|
)
|
|
|
|
var Client *redis.Client
|
|
|
|
func Init() {
|
|
Client = redis.NewClient(&redis.Options{
|
|
Addr: net.JoinHostPort(env.RedisHost, env.RedisPort),
|
|
DB: env.RedisDb,
|
|
Password: env.RedisPass,
|
|
})
|
|
}
|
|
|
|
func Exit() error {
|
|
if Client != nil {
|
|
return Client.Close()
|
|
}
|
|
return nil
|
|
}
|