package globals import ( "github.com/go-redsync/redsync/v4/redis/goredis/v9" "net" "platform/pkg/env" "github.com/go-redsync/redsync/v4" "github.com/redis/go-redis/v9" ) var Redis *redis.Client var Redsync *redsync.Redsync func initRedis() { client := redis.NewClient(&redis.Options{ Addr: net.JoinHostPort(env.RedisHost, env.RedisPort), DB: env.RedisDb, Password: env.RedisPass, }) pool := goredis.NewPool(client) sync := redsync.New(pool) Redis = client Redsync = sync } func ExitRedis() error { if Redis != nil { return Redis.Close() } return nil }