实现自动将热点数据加载到内存中

This commit is contained in:
GoEdgeLab
2021-11-14 16:15:07 +08:00
parent 7f80e32448
commit fff7e7a95d
9 changed files with 230 additions and 22 deletions

View File

@@ -13,6 +13,12 @@ func Begin(label string) *tracker {
return &tracker{label: label, startTime: time.Now()}
}
func Run(label string, f func()) {
var tr = Begin(label)
f()
tr.End()
}
func (this *tracker) End() {
SharedManager.Add(this.label, time.Since(this.startTime).Seconds()*1000)
}