go-common/app/job/main/search/service/stat.go

21 lines
353 B
Go
Raw Normal View History

2019-04-22 10:49:16 +00:00
package service
import (
"go-common/app/job/main/search/model"
)
// stat get stat
func (s *Service) stat(appid string) (st *model.Stat) {
s.mutex.RLock()
st = s.stats[appid]
s.mutex.RUnlock()
return
}
// updateStat update stat
func (s *Service) updateStat(appid string, st *model.Stat) {
s.mutex.Lock()
s.stats[appid] = st
s.mutex.Unlock()
}