diff --git a/pkg/util/memory.go b/pkg/util/memory.go index c4c32aa..6b7f64d 100644 --- a/pkg/util/memory.go +++ b/pkg/util/memory.go @@ -1,6 +1,7 @@ package util import ( + "gitee.com/timedb/wheatCache/pkg/errorx" "regexp" "strconv" "strings" @@ -8,7 +9,7 @@ import ( // ParseSizeToBit // 支持MB, GB, KB, 格式 "5KB" 或者 "5kb"等等 -func ParseSizeToBit(size string) int64 { +func ParseSizeToBit(size string) interface{} { sizes := regexp.MustCompile("^\\d+") sizeRes := sizes.FindAllString(size, 1) @@ -23,7 +24,7 @@ func ParseSizeToBit(size string) int64 { } else if strings.ToUpper(unit[1]) == "GB"{ return Res * 1024 *1024 * 1024 * 8 } - return -1 + return errorx.New("your size is wrong") }