feat(lru): feat lru clean
This commit is contained in:
parent
54f80ae1f3
commit
0bcf214080
pkg/lru
|
@ -6,6 +6,8 @@ import (
|
||||||
"gitee.com/timedb/wheatCache/pkg/errorx"
|
"gitee.com/timedb/wheatCache/pkg/errorx"
|
||||||
"gitee.com/timedb/wheatCache/pkg/event"
|
"gitee.com/timedb/wheatCache/pkg/event"
|
||||||
"gitee.com/timedb/wheatCache/pkg/structure"
|
"gitee.com/timedb/wheatCache/pkg/structure"
|
||||||
|
"gitee.com/timedb/wheatCache/pkg/util"
|
||||||
|
"github.com/spf13/viper"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -32,29 +34,29 @@ func (lru *SingleCache) UpdateLruSize(length structure.UpdateLength) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func cacheInit() (int64, int64, int) {
|
func cacheInit() (int64, int64, int) {
|
||||||
//maxSize := viper.GetString("lruCache.maxSize")
|
maxSize := viper.GetString("lruCache.maxSize")
|
||||||
//retMaxSize, maxErr := util.ParseSizeToBit(maxSize)
|
retMaxSize, maxErr := util.ParseSizeToBit(maxSize)
|
||||||
//if maxErr != nil {
|
if maxErr != nil {
|
||||||
// return 0, 0, 0
|
return 0, 0, 0
|
||||||
//}
|
}
|
||||||
//if retMaxSize == 0 {
|
if retMaxSize == 0 {
|
||||||
// retMaxSize = lruMaxSize
|
retMaxSize = lruMaxSize
|
||||||
//}
|
}
|
||||||
//
|
|
||||||
//clearSize := viper.GetString("lruCache.clearSize")
|
clearSize := viper.GetString("lruCache.clearSize")
|
||||||
//retClearSize, clearErr := util.ParseSizeToBit(clearSize)
|
retClearSize, clearErr := util.ParseSizeToBit(clearSize)
|
||||||
//if clearErr != nil {
|
if clearErr != nil {
|
||||||
// return 0, 0, 0
|
return 0, 0, 0
|
||||||
//}
|
}
|
||||||
//if retClearSize == 0 {
|
if retClearSize == 0 {
|
||||||
// retClearSize = lruClearSize
|
retClearSize = lruClearSize
|
||||||
//}
|
}
|
||||||
//
|
|
||||||
//maxDriver := viper.GetInt("lruCache.eventDriverSize")
|
maxDriver := viper.GetInt("lruCache.eventDriverSize")
|
||||||
//if maxDriver == 0 {
|
if maxDriver == 0 {
|
||||||
// maxDriver = lruEventDriver
|
maxDriver = lruEventDriver
|
||||||
//}
|
}
|
||||||
return 30, 15, 2000
|
return retMaxSize, retClearSize, maxDriver
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewLRUCache lru初始化
|
// NewLRUCache lru初始化
|
||||||
|
|
Loading…
Reference in New Issue