mirror of
https://github.com/charlienet/go-mixed.git
synced 2025-07-18 08:32:40 +08:00
update
This commit is contained in:
@ -7,10 +7,17 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
_ "embed"
|
||||
|
||||
"github.com/charlienet/go-mixed/rand"
|
||||
"github.com/charlienet/go-mixed/redis"
|
||||
)
|
||||
|
||||
//go:embed redis_id_store.lua
|
||||
var redis_id_function string
|
||||
|
||||
var once sync.Once
|
||||
|
||||
type redisStore struct {
|
||||
rdb redis.Client
|
||||
key string // 缓存键
|
||||
@ -23,6 +30,8 @@ type redisStore struct {
|
||||
}
|
||||
|
||||
func NewRedisStore(key string, rdb redis.Client) *redisStore {
|
||||
once.Do(func() { rdb.LoadFunction(redis_id_function) })
|
||||
|
||||
return &redisStore{
|
||||
rdb: rdb,
|
||||
key: key,
|
||||
|
Reference in New Issue
Block a user