wheat-cache/pkg/lru/define.go

23 lines
335 B
Go
Raw Normal View History

2021-09-21 19:28:14 +08:00
package lru
2021-09-27 11:29:47 +08:00
2021-10-04 16:25:09 +08:00
import "sync"
2021-09-27 11:29:47 +08:00
type SingleWorkFunc func() interface{}
const (
2021-10-04 20:32:20 +08:00
OptionEventName = "operateEvent"
CleanEventName = "clearEvent"
2021-10-04 16:25:09 +08:00
WorkFuncEventKey = "workFunc"
)
2021-09-27 11:29:47 +08:00
2021-10-04 16:25:09 +08:00
var (
lruCacheOnce sync.Once
lruCache *singleCache
2021-09-27 11:29:47 +08:00
)
2021-10-04 20:32:20 +08:00
const (
lruMaxSize = 1*1024*1024*1024*8
lruClearSize = 0.5*1024*1024*1024*8
lruEventDriver = 2000
)