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