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