perf(lru): add the sync.Once to define

This commit is contained in:
HuangJiaLuo 2021-10-04 16:25:09 +08:00
parent 75e1251d22
commit 71ddeb4772
1 changed files with 8 additions and 2 deletions

View File

@ -1,10 +1,16 @@
package lru package lru
import "sync"
type SingleWorkFunc func() interface{} type SingleWorkFunc func() interface{}
const ( const (
OpEventName = "operateEvent" OpEventName = "operateEvent"
CleEventName = "clearEvent" CleEventName = "clearEvent"
WorkFuncEventKey = "workFunc"
WorkFuncEventCtxKey = "workFunc" )
var (
lruCacheOnce sync.Once
lruCache *singleCache
) )