package common import ( "git.hilo.cn/hilo-common/resource/mysql" "github.com/bluele/gcache" "time" ) // 改成lru var userMedalMergeLru = gcache.New(10000).LRU().Build() func GetUserMedalMergeCache(userId mysql.ID) ([]uint32, error) { if data, err := userMedalMergeLru.Get(userId); err == nil { return data.([]uint32), nil } return nil, nil } func SetUserMedalMergeCache(userId mysql.ID, data []uint32) { _ = userMedalMergeLru.SetWithExpire(userId, data, time.Minute*15) }