22 lines
339 B
Go
22 lines
339 B
Go
|
|
package diagram
|
||
|
|
|
||
|
|
import (
|
||
|
|
"sync"
|
||
|
|
|
||
|
|
"github.com/redis/go-redis/v9"
|
||
|
|
)
|
||
|
|
|
||
|
|
var (
|
||
|
|
client *redis.Client
|
||
|
|
once sync.Once
|
||
|
|
)
|
||
|
|
|
||
|
|
// GetClientInstance define func of get redis client instance
|
||
|
|
func GetClientInstance() *redis.Client {
|
||
|
|
once.Do(func() {
|
||
|
|
// TODO 根据配置文件初始化 redis client
|
||
|
|
client = &redis.Client{}
|
||
|
|
})
|
||
|
|
return client
|
||
|
|
}
|