diff --git a/apier/v1/smgenericv1_it_test.go b/apier/v1/smgenericv1_it_test.go index 919790b98..4219b7513 100644 --- a/apier/v1/smgenericv1_it_test.go +++ b/apier/v1/smgenericv1_it_test.go @@ -103,7 +103,7 @@ func TestSMGV1CacheStats(t *testing.T) { expectedStats := &utils.CacheStats{Destinations: 5, ReverseDestinations: 7, RatingPlans: 4, RatingProfiles: 9, Actions: 9, ActionPlans: 4, AccountActionPlans: 5, SharedGroups: 1, DerivedChargers: 1, LcrProfiles: 5, CdrStats: 6, Users: 3, Aliases: 1, ReverseAliases: 2, ResourceProfiles: 3, Resources: 3, StatQueues: 0, - StatQueueProfiles: 0, Thresholds: 6, ThresholdProfiles: 6, Filters: 0} + StatQueueProfiles: 0, Thresholds: 6, ThresholdProfiles: 6, Filters: 10} var args utils.AttrCacheStats if err := smgV1Rpc.Call("ApierV1.GetCacheStats", args, &rcvStats); err != nil { t.Error("Got error on ApierV1.GetCacheStats: ", err.Error()) diff --git a/config/config_defaults.go b/config/config_defaults.go index 2557bf60f..a2e053f1b 100755 --- a/config/config_defaults.go +++ b/config/config_defaults.go @@ -119,6 +119,7 @@ const CGRATES_CFG_JSON = ` "statqueues": {"limit": -1, "ttl": "1m", "static_ttl": false, "precache": false}, // statqueues with metrics "threshold_profiles": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false}, // control threshold profiles caching "thresholds": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false}, // control thresholds caching + "filters": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false}, // control filters caching }, diff --git a/config/config_json.go b/config/config_json.go index 824ab3f3c..c402f1da9 100644 --- a/config/config_json.go +++ b/config/config_json.go @@ -60,6 +60,7 @@ const ( RESOURCES_JSON = "resources" STATS_JSON = "stats" THRESHOLDS_JSON = "thresholds" + FILTERS_JSON = "filters" MAILER_JSN = "mailer" SURETAX_JSON = "suretax" ) diff --git a/config/config_json_test.go b/config/config_json_test.go index a44a711a8..4c8e03c54 100755 --- a/config/config_json_test.go +++ b/config/config_json_test.go @@ -133,6 +133,9 @@ func TestCacheJsonCfg(t *testing.T) { utils.CacheThresholds: &CacheParamJsonCfg{Limit: utils.IntPointer(-1), Ttl: utils.StringPointer(""), Static_ttl: utils.BoolPointer(false), Precache: utils.BoolPointer(false)}, + utils.CacheFilters: &CacheParamJsonCfg{Limit: utils.IntPointer(-1), + Ttl: utils.StringPointer(""), Static_ttl: utils.BoolPointer(false), + Precache: utils.BoolPointer(false)}, } if gCfg, err := dfCgrJsonCfg.CacheJsonCfg(); err != nil { diff --git a/config/config_test.go b/config/config_test.go index 3936675dd..0b4121803 100755 --- a/config/config_test.go +++ b/config/config_test.go @@ -458,7 +458,8 @@ func TestCgrCfgJSONDefaultsCacheCFG(t *testing.T) { TTL: time.Duration(0), StaticTTL: false, Precache: false}, utils.CacheThresholds: &CacheParamConfig{Limit: -1, TTL: time.Duration(0), StaticTTL: false, Precache: false}, - } + utils.CacheFilters: &CacheParamConfig{Limit: -1, + TTL: time.Duration(0), StaticTTL: false, Precache: false}} if !reflect.DeepEqual(eCacheCfg, cgrCfg.CacheConfig) { t.Errorf("received: %s, \nexpecting: %s", utils.ToJSON(eCacheCfg), utils.ToJSON(cgrCfg.CacheConfig)) } diff --git a/general_tests/tut_smgeneric_it_test.go b/general_tests/tut_smgeneric_it_test.go index a221e59ed..de0fcf163 100644 --- a/general_tests/tut_smgeneric_it_test.go +++ b/general_tests/tut_smgeneric_it_test.go @@ -100,7 +100,7 @@ func TestTutSMGCacheStats(t *testing.T) { var rcvStats *utils.CacheStats expectedStats := &utils.CacheStats{Destinations: 5, ReverseDestinations: 7, RatingPlans: 4, RatingProfiles: 9, Actions: 9, ActionPlans: 4, AccountActionPlans: 5, SharedGroups: 1, DerivedChargers: 1, LcrProfiles: 5, - CdrStats: 6, Users: 3, Aliases: 1, ReverseAliases: 2, ResourceProfiles: 3, Resources: 3, StatQueues: 0, StatQueueProfiles: 0, Thresholds: 6, ThresholdProfiles: 6} + CdrStats: 6, Users: 3, Aliases: 1, ReverseAliases: 2, ResourceProfiles: 3, Resources: 3, StatQueues: 0, StatQueueProfiles: 0, Thresholds: 6, ThresholdProfiles: 6, Filters: 10} var args utils.AttrCacheStats if err := tutSMGRpc.Call("ApierV2.GetCacheStats", args, &rcvStats); err != nil { t.Error("Got error on ApierV2.GetCacheStats: ", err.Error()) diff --git a/general_tests/tutorial_it_test.go b/general_tests/tutorial_it_test.go index a579ac611..8578528ca 100644 --- a/general_tests/tutorial_it_test.go +++ b/general_tests/tutorial_it_test.go @@ -104,7 +104,7 @@ func TestTutITCacheStats(t *testing.T) { var rcvStats *utils.CacheStats expectedStats := &utils.CacheStats{Destinations: 5, ReverseDestinations: 7, RatingPlans: 4, RatingProfiles: 9, Actions: 9, ActionPlans: 4, AccountActionPlans: 5, SharedGroups: 1, DerivedChargers: 1, LcrProfiles: 5, - CdrStats: 6, Users: 3, Aliases: 1, ReverseAliases: 2, ResourceProfiles: 3, Resources: 3, StatQueues: 0, StatQueueProfiles: 0, Thresholds: 6, ThresholdProfiles: 6, Filters: 0} + CdrStats: 6, Users: 3, Aliases: 1, ReverseAliases: 2, ResourceProfiles: 3, Resources: 3, StatQueues: 0, StatQueueProfiles: 0, Thresholds: 6, ThresholdProfiles: 6, Filters: 10} var args utils.AttrCacheStats if err := tutLocalRpc.Call("ApierV1.GetCacheStats", args, &rcvStats); err != nil { t.Error("Got error on ApierV1.GetCacheStats: ", err.Error()) diff --git a/utils/consts.go b/utils/consts.go index dc47059a0..e4849ca42 100755 --- a/utils/consts.go +++ b/utils/consts.go @@ -63,6 +63,7 @@ var ( CacheStatQueues: StatQueuePrefix, CacheThresholdProfiles: ThresholdProfilePrefix, CacheThresholds: ThresholdPrefix, + CacheFilters: FilterPrefix, } CachePrefixToInstance map[string]string // will be built on init )