package services

import (
	"sync"

	"github.com/fiskerinc/cloud-services/pkg/redisv2"
)

var (
	redisClientOnce sync.Once
	redisClient     *redisv2.Connection
)

func GetRedisV2Client() *redisv2.Connection {
	redisClientOnce.Do(func() {
		if redisClient == nil {
			redisClient = redisv2.NewClient(nil)
		}
	})

	return redisClient
}

func SetRedisV2Client(cp *redisv2.Connection) {
	redisClient = cp
}