本文整理汇总了Golang中github.com/cgrates/cgrates/utils.CacheStats类的典型用法代码示例。如果您正苦于以下问题:Golang CacheStats类的具体用法?Golang CacheStats怎么用?Golang CacheStats使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CacheStats类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: GetCacheStats
func (self *ApierV1) GetCacheStats(attrs utils.AttrCacheStats, reply *utils.CacheStats) error {
cs := new(utils.CacheStats)
cs.Destinations = cache2go.CountEntries(engine.DESTINATION_PREFIX)
cs.RatingPlans = cache2go.CountEntries(engine.RATING_PLAN_PREFIX)
cs.RatingProfiles = cache2go.CountEntries(engine.RATING_PROFILE_PREFIX)
cs.Actions = cache2go.CountEntries(engine.ACTION_PREFIX)
cs.SharedGroups = cache2go.CountEntries(engine.SHARED_GROUP_PREFIX)
cs.RatingAliases = cache2go.CountEntries(engine.RP_ALIAS_PREFIX)
cs.AccountAliases = cache2go.CountEntries(engine.ACC_ALIAS_PREFIX)
cs.DerivedChargers = cache2go.CountEntries(engine.DERIVEDCHARGERS_PREFIX)
*reply = *cs
return nil
}
示例2: GetCacheStats
func (self *ApierV1) GetCacheStats(attrs utils.AttrCacheStats, reply *utils.CacheStats) error {
cs := new(utils.CacheStats)
cs.Destinations = cache2go.CountEntries(utils.DESTINATION_PREFIX)
cs.RatingPlans = cache2go.CountEntries(utils.RATING_PLAN_PREFIX)
cs.RatingProfiles = cache2go.CountEntries(utils.RATING_PROFILE_PREFIX)
cs.Actions = cache2go.CountEntries(utils.ACTION_PREFIX)
cs.SharedGroups = cache2go.CountEntries(utils.SHARED_GROUP_PREFIX)
cs.DerivedChargers = cache2go.CountEntries(utils.DERIVEDCHARGERS_PREFIX)
cs.LcrProfiles = cache2go.CountEntries(utils.LCR_PREFIX)
cs.Aliases = cache2go.CountEntries(utils.ALIASES_PREFIX)
if self.CdrStatsSrv != nil && self.Config.CDRStatsEnabled {
var queueIds []string
if err := self.CdrStatsSrv.GetQueueIds(0, &queueIds); err != nil {
return utils.NewErrServerError(err)
}
cs.CdrStats = len(queueIds)
}
if self.Config.RaterUserServer == utils.INTERNAL {
var ups engine.UserProfiles
if err := self.Users.GetUsers(engine.UserProfile{}, &ups); err != nil {
return utils.NewErrServerError(err)
}
cs.Users = len(ups)
}
if loadHistInsts, err := self.AccountDb.GetLoadHistory(1, false); err != nil || len(loadHistInsts) == 0 {
if err != nil { // Not really an error here since we only count in cache
engine.Logger.Err(fmt.Sprintf("ApierV1.GetCacheStats, error on GetLoadHistory: %s"))
}
cs.LastLoadId = utils.NOT_AVAILABLE
cs.LastLoadTime = utils.NOT_AVAILABLE
} else {
cs.LastLoadId = loadHistInsts[0].LoadId
cs.LastLoadTime = loadHistInsts[0].LoadTime.Format(time.RFC3339)
}
*reply = *cs
return nil
}
示例3: GetCacheStats
func (self *ApierV1) GetCacheStats(attrs utils.AttrCacheStats, reply *utils.CacheStats) error {
cs := new(utils.CacheStats)
cs.Destinations = cache.CountEntries(utils.DESTINATION_PREFIX)
cs.ReverseDestinations = cache.CountEntries(utils.REVERSE_DESTINATION_PREFIX)
cs.RatingPlans = cache.CountEntries(utils.RATING_PLAN_PREFIX)
cs.RatingProfiles = cache.CountEntries(utils.RATING_PROFILE_PREFIX)
cs.Actions = cache.CountEntries(utils.ACTION_PREFIX)
cs.ActionPlans = cache.CountEntries(utils.ACTION_PLAN_PREFIX)
cs.SharedGroups = cache.CountEntries(utils.SHARED_GROUP_PREFIX)
cs.DerivedChargers = cache.CountEntries(utils.DERIVEDCHARGERS_PREFIX)
cs.LcrProfiles = cache.CountEntries(utils.LCR_PREFIX)
cs.Aliases = cache.CountEntries(utils.ALIASES_PREFIX)
cs.ReverseAliases = cache.CountEntries(utils.REVERSE_ALIASES_PREFIX)
cs.ResourceLimits = cache.CountEntries(utils.ResourceLimitsPrefix)
if self.CdrStatsSrv != nil {
var queueIds []string
if err := self.CdrStatsSrv.Call("CDRStatsV1.GetQueueIds", 0, &queueIds); err != nil {
return utils.NewErrServerError(err)
}
cs.CdrStats = len(queueIds)
}
if self.Users != nil {
var ups engine.UserProfiles
if err := self.Users.Call("UsersV1.GetUsers", &engine.UserProfile{}, &ups); err != nil {
return utils.NewErrServerError(err)
}
cs.Users = len(ups)
}
*reply = *cs
return nil
}