29 lines
423 B
Go
29 lines
423 B
Go
package services
|
|
|
|
import (
|
|
"sync"
|
|
|
|
"github.com/fiskerinc/cloud-services/pkg/redis"
|
|
)
|
|
|
|
var (
|
|
clientPoolOnce sync.Once
|
|
clientPool redis.ClientPoolInterface
|
|
)
|
|
|
|
func RedisClientPool() redis.ClientPoolInterface {
|
|
clientPoolOnce.Do(func() {
|
|
if clientPool != nil {
|
|
return
|
|
}
|
|
|
|
clientPool = redis.NewClientPool()
|
|
})
|
|
|
|
return clientPool
|
|
}
|
|
|
|
func SetRedisClientPool(cp redis.ClientPoolInterface) {
|
|
clientPool = cp
|
|
}
|