本周日【珠海源创会】一起聊聊:PingCAP分布式事务、支付宝移动端实践、GSBN技术框架选型,点此报名占座

hhxsv5 / go-redis-memory-analysisGoMIT

Watch 10 Star 25 Fork 4
Sign up for free
Explore and code with more than 2 million developers,Free private repositories !:)
Sign up
Go 实现的 Redis 内存分析工具:用于找出占用内存较多的 Key,将结果导出至 CSV 文件。 spread retract

https://github.com/hhxsv5/go-redis-memory-analysis

analysis_interface.go 829 Bytes
Copy Edit Web IDE Raw Blame History
XieBiao authored 2018-04-24 14:08 . make interface
package gorma
type AnalysisInterface interface {
Start(delimiters []string)
SaveReports(folder string) error
Close()
}
type Report struct {
Key string
Count uint64
Size uint64
NeverExpire uint64
AvgTtl uint64
}
type DBReports map[uint64][]Report
type KeyReports map[string]Report
type SortBySizeReports []Report
type SortByCountReports []Report
func (sr SortBySizeReports) Len() int {
return len(sr)
}
func (sr SortBySizeReports) Less(i, j int) bool {
return sr[i].Size > sr[j].Size
}
func (sr SortBySizeReports) Swap(i, j int) {
sr[i], sr[j] = sr[j], sr[i]
}
func (sr SortByCountReports) Len() int {
return len(sr)
}
func (sr SortByCountReports) Less(i, j int) bool {
return sr[i].Count > sr[j].Count
}
func (sr SortByCountReports) Swap(i, j int) {
sr[i], sr[j] = sr[j], sr[i]
}

Comment ( 0 )

You need to Sign in for post a comment

Help Search

12_float_left_people 12_float_left_close