diff --git a/pkg/lru/define.go b/pkg/lru/define.go index c5cedb2..ce392c4 100644 --- a/pkg/lru/define.go +++ b/pkg/lru/define.go @@ -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 ( diff --git a/pkg/util/memory.go b/pkg/util/memory.go index c0f5ef3..cc63f53 100644 --- a/pkg/util/memory.go +++ b/pkg/util/memory.go @@ -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") } } - -