LcgProfiles added in cache stats

This commit is contained in:
DanB
2015-05-24 18:32:46 +02:00
parent 73be367dd7
commit 83bab44b3c
2 changed files with 8 additions and 1 deletions

View File

@@ -915,6 +915,7 @@ func (self *ApierV1) GetCacheStats(attrs utils.AttrCacheStats, reply *utils.Cach
cs.RatingAliases = cache2go.CountEntries(engine.RP_ALIAS_PREFIX)
cs.AccountAliases = cache2go.CountEntries(engine.ACC_ALIAS_PREFIX)
cs.DerivedChargers = cache2go.CountEntries(engine.DERIVEDCHARGERS_PREFIX)
cs.LcrProfiles = cache2go.CountEntries(engine.LCR_PREFIX)
*reply = *cs
return nil
}
@@ -926,7 +927,8 @@ func (self *ApierV1) GetCachedItemAge(itemId string, reply *utils.CachedItemAge)
cachedItemAge := new(utils.CachedItemAge)
var found bool
for idx, cacheKey := range []string{engine.DESTINATION_PREFIX + itemId, engine.RATING_PLAN_PREFIX + itemId, engine.RATING_PROFILE_PREFIX + itemId,
engine.ACTION_PREFIX + itemId, engine.SHARED_GROUP_PREFIX + itemId, engine.RP_ALIAS_PREFIX + itemId, engine.ACC_ALIAS_PREFIX + itemId} {
engine.ACTION_PREFIX + itemId, engine.SHARED_GROUP_PREFIX + itemId, engine.RP_ALIAS_PREFIX + itemId, engine.ACC_ALIAS_PREFIX + itemId,
engine.LCR_PREFIX + itemId} {
if age, err := cache2go.GetKeyAge(cacheKey); err == nil {
found = true
switch idx {
@@ -944,6 +946,8 @@ func (self *ApierV1) GetCachedItemAge(itemId string, reply *utils.CachedItemAge)
cachedItemAge.RatingAlias = age
case 6:
cachedItemAge.AccountAlias = age
case 7:
cachedItemAge.LcrProfiles = age
}
}
}

View File

@@ -634,6 +634,7 @@ type ApiReloadCache struct {
AccAliases []string
LCRIds []string
DerivedChargers []string
LcrProfiles []string
}
type AttrCacheStats struct { // Add in the future filters here maybe so we avoid counting complete cache
@@ -648,6 +649,7 @@ type CacheStats struct {
RatingAliases int
AccountAliases int
DerivedChargers int
LcrProfiles int
}
type AttrCachedItemAge struct {
@@ -664,6 +666,7 @@ type CachedItemAge struct {
RatingAlias time.Duration
AccountAlias time.Duration
DerivedChargers time.Duration
LcrProfiles time.Duration
}
type AttrExpFileCdrs struct {