hhxsv5/go-redis-memory-analysis

优化: 遍历所有db输出到一个文件和根据keyType类型统计key

Closed this issue · 2 comments

1.统计的字段区分keyType,以string类型为例
AnalysisConnection的Reports 类型需要修改
type AnalysisConnection struct {
redis *storages.RedisClient
Reports map[string][]Report
}

var(
stringSortBySizeReports SortBySizeReports //String类型SortBySizeReports
)
reportMap := make(map[string]SortBySizeReports)
//循环代码
//赋值
reportMap["strType"] = stringSortBySizeReports
//赋值
analysis.Reports["strType"] = reportMap["strType"]

2.所有db文件输出到一个文件
template := fmt.Sprintf("%s%s%s%s", folder, string(os.PathSeparator), “demo”, ".json")
filename = template
fp, err := storages.NewFile(filename, os.O_WRONLY|os.O_CREATE|os.O_APPEND, os.ModePerm)

以上。

欢迎PR。

欢迎PR。

好滴