fix(lru): fix length byte

This commit is contained in:
bandl 2021-10-25 11:08:18 +08:00
parent 3f4607fb58
commit 9298b77c7c
2 changed files with 12 additions and 12 deletions

View File

@ -1,10 +1,11 @@
package lru
import (
"gitee.com/timedb/wheatCache/pkg/proto"
"gitee.com/timedb/wheatCache/pkg/structure"
"sync"
"time"
"gitee.com/timedb/wheatCache/pkg/proto"
"gitee.com/timedb/wheatCache/pkg/structure"
)
type SingleWorkFunc func() interface{}
@ -22,8 +23,8 @@ var (
)
const (
defaultLruMaxSize = 1 * 1024 * 1024 * 1024 * 8
defaultLruClearSize = 0.5 * 1024 * 1024 * 1024 * 8
defaultLruMaxSize = 1 * 1024 * 1024 * 1024
defaultLruClearSize = 0.5 * 1024 * 1024 * 1024
defaultLruEventDriver = 2000
)
const (

View File

@ -1,10 +1,11 @@
package util
import (
"gitee.com/timedb/wheatCache/pkg/errorx"
"regexp"
"strconv"
"strings"
"gitee.com/timedb/wheatCache/pkg/errorx"
)
// ParseSizeToBit
@ -17,16 +18,14 @@ func ParseSizeToBit(size string) (int64, error) {
sizeType := strings.ToUpper(unit[1])
switch {
case sizeType == "BIT" || sizeType == "B":
return Res * 8, nil
return Res, nil
case sizeType == "KB":
return Res * 1024 * 8, nil
case sizeType =="MB":
return Res * 1024 * 1024 * 8, nil
return Res * 1024, nil
case sizeType == "MB":
return Res * 1024 * 1024, nil
case sizeType == "GB":
return Res * 1024 *1024 * 1024 * 8, nil
return Res * 1024 * 1024 * 1024, nil
default:
return 0, errorx.New("your size is wrong")
}
}