forked from p93542168/wheat-cache
feat(lru): update lru clean work
This commit is contained in:
parent
73e91b3ff0
commit
922fae0f78
|
@ -3,7 +3,6 @@ package lru
|
|||
import (
|
||||
"context"
|
||||
"gitee.com/timedb/wheatCache/pkg/event"
|
||||
"gitee.com/timedb/wheatCache/pkg/logx"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
@ -22,9 +21,9 @@ func (lru *SingleCache) cleanWork() {
|
|||
lruCleanEvent.SetValue(WorkFuncEventKey, work)
|
||||
|
||||
lru.lruCleanProduce.Call(cxt, lruCleanEvent)
|
||||
_, err := lruCleanEvent.StartWaitEvent(20 * time.Minute) //常量
|
||||
_, err := lruCleanEvent.StartWaitEvent(defaultWaitTime)
|
||||
if err != nil {
|
||||
logx.With(cxt, ).Error("cleanWork err: %v", err)
|
||||
//logx.With(cxt, ).Error("cleanWork err: %v", err)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"gitee.com/timedb/wheatCache/pkg/proto"
|
||||
"gitee.com/timedb/wheatCache/pkg/structure"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
type SingleWorkFunc func() interface{}
|
||||
|
@ -24,7 +25,9 @@ const (
|
|||
defaultLruClearSize = 0.5 * 1024 * 1024 * 1024 * 8
|
||||
defaultLruEventDriver = 2000
|
||||
)
|
||||
|
||||
const (
|
||||
defaultWaitTime = 20 * time.Minute
|
||||
)
|
||||
type CacheInterface interface {
|
||||
Del() error
|
||||
Get(key *proto.BaseKey) (structure.KeyBaseInterface, bool)
|
||||
|
|
Loading…
Reference in New Issue