Add TTL parameter for *internal DB

This commit is contained in:
TeoV
2020-01-14 04:18:18 -05:00
parent 04d38094e5
commit 434cd8bb47
4 changed files with 397 additions and 140 deletions

View File

@@ -73,31 +73,31 @@ const CGRATES_CFG_JSON = `
"remote_conns":[],
"replication_conns":[],
"items":{
"*accounts":{"remote":false,"replicate":false},
"*reverse_destinations": {"remote":false,"replicate":false},
"*destinations": {"remote":false,"replicate":false},
"*rating_plans": {"remote":false,"replicate":false},
"*rating_profiles":{"remote":false,"replicate":false},
"*actions":{"remote":false,"replicate":false},
"*action_plans": {"remote":false,"replicate":false},
"*account_action_plans":{"remote":false,"replicate":false},
"*action_triggers":{"remote":false,"replicate":false},
"*shared_groups":{"remote":false,"replicate":false},
"*timings": {"remote":false,"replicate":false},
"*resource_profiles":{"remote":false,"replicate":false},
"*resources":{"remote":false,"replicate":false},
"*statqueue_profiles": {"remote":false,"replicate":false},
"*statqueues": {"remote":false,"replicate":false},
"*threshold_profiles": {"remote":false,"replicate":false},
"*thresholds": {"remote":false,"replicate":false},
"*filters": {"remote":false,"replicate":false},
"*supplier_profiles":{"remote":false,"replicate":false},
"*attribute_profiles":{"remote":false,"replicate":false},
"*charger_profiles": {"remote":false,"replicate":false},
"*dispatcher_profiles":{"remote":false,"replicate":false},
"*dispatcher_hosts":{"remote":false,"replicate":false},
"*filter_indexes" :{"remote":false,"replicate":false},
"*load_ids":{"remote":false,"replicate":false},
"*accounts":{"remote":false,"replicate":false,"ttl": ""},
"*reverse_destinations": {"remote":false,"replicate":false,"ttl": ""},
"*destinations": {"remote":false,"replicate":false,"ttl": ""},
"*rating_plans": {"remote":false,"replicate":false,"ttl": ""},
"*rating_profiles":{"remote":false,"replicate":false,"ttl": ""},
"*actions":{"remote":false,"replicate":false,"ttl": ""},
"*action_plans": {"remote":false,"replicate":false,"ttl": ""},
"*account_action_plans":{"remote":false,"replicate":false,"ttl": ""},
"*action_triggers":{"remote":false,"replicate":false,"ttl": ""},
"*shared_groups":{"remote":false,"replicate":false,"ttl": ""},
"*timings": {"remote":false,"replicate":false,"ttl": ""},
"*resource_profiles":{"remote":false,"replicate":false,"ttl": ""},
"*resources":{"remote":false,"replicate":false,"ttl": ""},
"*statqueue_profiles": {"remote":false,"replicate":false,"ttl": ""},
"*statqueues": {"remote":false,"replicate":false,"ttl": ""},
"*threshold_profiles": {"remote":false,"replicate":false,"ttl": ""},
"*thresholds": {"remote":false,"replicate":false,"ttl": ""},
"*filters": {"remote":false,"replicate":false,"ttl": ""},
"*supplier_profiles":{"remote":false,"replicate":false,"ttl": ""},
"*attribute_profiles":{"remote":false,"replicate":false,"ttl": ""},
"*charger_profiles": {"remote":false,"replicate":false,"ttl": ""},
"*dispatcher_profiles":{"remote":false,"replicate":false,"ttl": ""},
"*dispatcher_hosts":{"remote":false,"replicate":false,"ttl": ""},
"*filter_indexes" :{"remote":false,"replicate":false,"ttl": ""},
"*load_ids":{"remote":false,"replicate":false,"ttl": ""},
},
},
@@ -116,6 +116,31 @@ const CGRATES_CFG_JSON = `
"prefix_indexed_fields":[], // prefix indexes on cdrs table to speed up queries, used in case of *internal
"query_timeout":"10s",
"sslmode":"disable", // sslmode in case of *postgres
"items":{
"session_costs": {"ttl": ""},
"cdrs": {"ttl": ""},
"tp_timings":{"ttl": ""},
"tp_destinations": {"ttl": ""},
"tp_rates": {"ttl": ""},
"tp_destination_rates": {"ttl": ""},
"tp_rating_plans":{"ttl": ""},
"tp_rating_profiles":{"ttl": ""},
"tp_shared_groups": {"ttl": ""},
"tp_actions":{"ttl": ""},
"tp_action_plans":{"ttl": ""},
"tp_action_triggers":{"ttl": ""},
"tp_account_actions": {"ttl": ""},
"tp_resources":{"ttl": ""},
"tp_stats":{"ttl": ""},
"tp_thresholds": {"ttl": ""},
"tp_filters": {"ttl": ""},
"tp_suppliers": {"ttl": ""},
"tp_attributes":{"ttl": ""},
"tp_chargers":{"ttl": ""},
"versions": {"ttl": ""},
"tp_dispatcher_profiles":{"ttl": ""},
"tp_dispatcher_hosts":{"ttl": ""},
},
},

View File

@@ -204,82 +204,107 @@ func TestDfDataDbJsonCfg(t *testing.T) {
Query_timeout: utils.StringPointer("10s"),
Replication_conns: &[]string{},
Remote_conns: &[]string{},
Items: &map[string]*ItemRmtRplOptJson{
utils.MetaAccounts: &ItemRmtRplOptJson{
Items: &map[string]*ItemOptJson{
utils.MetaAccounts: &ItemOptJson{
Replicate: utils.BoolPointer(false),
Remote: utils.BoolPointer(false)},
utils.MetaReverseDestinations: &ItemRmtRplOptJson{
Remote: utils.BoolPointer(false),
Ttl: utils.StringPointer(utils.EmptyString)},
utils.MetaReverseDestinations: &ItemOptJson{
Replicate: utils.BoolPointer(false),
Remote: utils.BoolPointer(false)},
utils.MetaDestinations: &ItemRmtRplOptJson{
Remote: utils.BoolPointer(false),
Ttl: utils.StringPointer(utils.EmptyString)},
utils.MetaDestinations: &ItemOptJson{
Replicate: utils.BoolPointer(false),
Remote: utils.BoolPointer(false)},
utils.MetaRatingPlans: &ItemRmtRplOptJson{
Remote: utils.BoolPointer(false),
Ttl: utils.StringPointer(utils.EmptyString)},
utils.MetaRatingPlans: &ItemOptJson{
Replicate: utils.BoolPointer(false),
Remote: utils.BoolPointer(false)},
utils.MetaRatingProfiles: &ItemRmtRplOptJson{
Remote: utils.BoolPointer(false),
Ttl: utils.StringPointer(utils.EmptyString)},
utils.MetaRatingProfiles: &ItemOptJson{
Replicate: utils.BoolPointer(false),
Remote: utils.BoolPointer(false)},
utils.MetaActions: &ItemRmtRplOptJson{
Remote: utils.BoolPointer(false),
Ttl: utils.StringPointer(utils.EmptyString)},
utils.MetaActions: &ItemOptJson{
Replicate: utils.BoolPointer(false),
Remote: utils.BoolPointer(false)},
utils.MetaActionPlans: &ItemRmtRplOptJson{
Remote: utils.BoolPointer(false),
Ttl: utils.StringPointer(utils.EmptyString)},
utils.MetaActionPlans: &ItemOptJson{
Replicate: utils.BoolPointer(false),
Remote: utils.BoolPointer(false)},
utils.MetaAccountActionPlans: &ItemRmtRplOptJson{
Remote: utils.BoolPointer(false),
Ttl: utils.StringPointer(utils.EmptyString)},
utils.MetaAccountActionPlans: &ItemOptJson{
Replicate: utils.BoolPointer(false),
Remote: utils.BoolPointer(false)},
utils.MetaActionTriggers: &ItemRmtRplOptJson{
Remote: utils.BoolPointer(false),
Ttl: utils.StringPointer(utils.EmptyString)},
utils.MetaActionTriggers: &ItemOptJson{
Replicate: utils.BoolPointer(false),
Remote: utils.BoolPointer(false)},
utils.MetaSharedGroups: &ItemRmtRplOptJson{
Remote: utils.BoolPointer(false),
Ttl: utils.StringPointer(utils.EmptyString)},
utils.MetaSharedGroups: &ItemOptJson{
Replicate: utils.BoolPointer(false),
Remote: utils.BoolPointer(false)},
utils.MetaTimings: &ItemRmtRplOptJson{
Remote: utils.BoolPointer(false),
Ttl: utils.StringPointer(utils.EmptyString)},
utils.MetaTimings: &ItemOptJson{
Replicate: utils.BoolPointer(false),
Remote: utils.BoolPointer(false)},
utils.MetaResourceProfile: &ItemRmtRplOptJson{
Remote: utils.BoolPointer(false),
Ttl: utils.StringPointer(utils.EmptyString)},
utils.MetaResourceProfile: &ItemOptJson{
Replicate: utils.BoolPointer(false),
Remote: utils.BoolPointer(false)},
utils.MetaStatQueues: &ItemRmtRplOptJson{
Remote: utils.BoolPointer(false),
Ttl: utils.StringPointer(utils.EmptyString)},
utils.MetaStatQueues: &ItemOptJson{
Replicate: utils.BoolPointer(false),
Remote: utils.BoolPointer(false)},
utils.MetaResources: &ItemRmtRplOptJson{
Remote: utils.BoolPointer(false),
Ttl: utils.StringPointer(utils.EmptyString)},
utils.MetaResources: &ItemOptJson{
Replicate: utils.BoolPointer(false),
Remote: utils.BoolPointer(false)},
utils.MetaStatQueueProfiles: &ItemRmtRplOptJson{
Remote: utils.BoolPointer(false),
Ttl: utils.StringPointer(utils.EmptyString)},
utils.MetaStatQueueProfiles: &ItemOptJson{
Replicate: utils.BoolPointer(false),
Remote: utils.BoolPointer(false)},
utils.MetaThresholds: &ItemRmtRplOptJson{
Remote: utils.BoolPointer(false),
Ttl: utils.StringPointer(utils.EmptyString)},
utils.MetaThresholds: &ItemOptJson{
Replicate: utils.BoolPointer(false),
Remote: utils.BoolPointer(false)},
utils.MetaThresholdProfiles: &ItemRmtRplOptJson{
Remote: utils.BoolPointer(false),
Ttl: utils.StringPointer(utils.EmptyString)},
utils.MetaThresholdProfiles: &ItemOptJson{
Replicate: utils.BoolPointer(false),
Remote: utils.BoolPointer(false)},
utils.MetaFilters: &ItemRmtRplOptJson{
Remote: utils.BoolPointer(false),
Ttl: utils.StringPointer(utils.EmptyString)},
utils.MetaFilters: &ItemOptJson{
Replicate: utils.BoolPointer(false),
Remote: utils.BoolPointer(false)},
utils.MetaSupplierProfiles: &ItemRmtRplOptJson{
Remote: utils.BoolPointer(false),
Ttl: utils.StringPointer(utils.EmptyString)},
utils.MetaSupplierProfiles: &ItemOptJson{
Replicate: utils.BoolPointer(false),
Remote: utils.BoolPointer(false)},
utils.MetaAttributeProfiles: &ItemRmtRplOptJson{
Remote: utils.BoolPointer(false),
Ttl: utils.StringPointer(utils.EmptyString)},
utils.MetaAttributeProfiles: &ItemOptJson{
Replicate: utils.BoolPointer(false),
Remote: utils.BoolPointer(false)},
utils.MetaDispatcherHosts: &ItemRmtRplOptJson{
Remote: utils.BoolPointer(false),
Ttl: utils.StringPointer(utils.EmptyString)},
utils.MetaDispatcherHosts: &ItemOptJson{
Replicate: utils.BoolPointer(false),
Remote: utils.BoolPointer(false)},
utils.MetaChargerProfiles: &ItemRmtRplOptJson{
Remote: utils.BoolPointer(false),
Ttl: utils.StringPointer(utils.EmptyString)},
utils.MetaChargerProfiles: &ItemOptJson{
Replicate: utils.BoolPointer(false),
Remote: utils.BoolPointer(false)},
utils.MetaDispatcherProfiles: &ItemRmtRplOptJson{
Remote: utils.BoolPointer(false),
Ttl: utils.StringPointer(utils.EmptyString)},
utils.MetaDispatcherProfiles: &ItemOptJson{
Replicate: utils.BoolPointer(false),
Remote: utils.BoolPointer(false)},
utils.MetaFilterIndexes: &ItemRmtRplOptJson{
Remote: utils.BoolPointer(false),
Ttl: utils.StringPointer(utils.EmptyString)},
utils.MetaFilterIndexes: &ItemOptJson{
Replicate: utils.BoolPointer(false),
Remote: utils.BoolPointer(false)},
utils.MetaLoadIDs: &ItemRmtRplOptJson{
Remote: utils.BoolPointer(false),
Ttl: utils.StringPointer(utils.EmptyString)},
utils.MetaLoadIDs: &ItemOptJson{
Replicate: utils.BoolPointer(false),
Remote: utils.BoolPointer(false)},
Remote: utils.BoolPointer(false),
Ttl: utils.StringPointer(utils.EmptyString)},
},
}
if cfg, err := dfCgrJsonCfg.DbJsonCfg(DATADB_JSN); err != nil {
@@ -304,11 +329,59 @@ func TestDfStorDBJsonCfg(t *testing.T) {
Prefix_indexed_fields: &[]string{},
Query_timeout: utils.StringPointer("10s"),
Sslmode: utils.StringPointer(utils.PostgressSSLModeDisable),
Items: &map[string]*ItemOptJson{
utils.TBLTPTimings: &ItemOptJson{
Ttl: utils.StringPointer(utils.EmptyString)},
utils.TBLTPDestinations: &ItemOptJson{
Ttl: utils.StringPointer(utils.EmptyString)},
utils.TBLTPRates: &ItemOptJson{
Ttl: utils.StringPointer(utils.EmptyString)},
utils.TBLTPDestinationRates: &ItemOptJson{
Ttl: utils.StringPointer(utils.EmptyString)},
utils.TBLTPRatingPlans: &ItemOptJson{
Ttl: utils.StringPointer(utils.EmptyString)},
utils.TBLTPRateProfiles: &ItemOptJson{
Ttl: utils.StringPointer(utils.EmptyString)},
utils.TBLTPSharedGroups: &ItemOptJson{
Ttl: utils.StringPointer(utils.EmptyString)},
utils.TBLTPActions: &ItemOptJson{
Ttl: utils.StringPointer(utils.EmptyString)},
utils.TBLTPActionTriggers: &ItemOptJson{
Ttl: utils.StringPointer(utils.EmptyString)},
utils.TBLTPAccountActions: &ItemOptJson{
Ttl: utils.StringPointer(utils.EmptyString)},
utils.TBLTPResources: &ItemOptJson{
Ttl: utils.StringPointer(utils.EmptyString)},
utils.TBLTPStats: &ItemOptJson{
Ttl: utils.StringPointer(utils.EmptyString)},
utils.TBLTPThresholds: &ItemOptJson{
Ttl: utils.StringPointer(utils.EmptyString)},
utils.TBLTPFilters: &ItemOptJson{
Ttl: utils.StringPointer(utils.EmptyString)},
utils.SessionCostsTBL: &ItemOptJson{
Ttl: utils.StringPointer(utils.EmptyString)},
utils.TBLTPActionPlans: &ItemOptJson{
Ttl: utils.StringPointer(utils.EmptyString)},
utils.TBLTPSuppliers: &ItemOptJson{
Ttl: utils.StringPointer(utils.EmptyString)},
utils.TBLTPAttributes: &ItemOptJson{
Ttl: utils.StringPointer(utils.EmptyString)},
utils.TBLTPChargers: &ItemOptJson{
Ttl: utils.StringPointer(utils.EmptyString)},
utils.TBLTPDispatchers: &ItemOptJson{
Ttl: utils.StringPointer(utils.EmptyString)},
utils.TBLTPDispatcherHosts: &ItemOptJson{
Ttl: utils.StringPointer(utils.EmptyString)},
utils.CDRsTBL: &ItemOptJson{
Ttl: utils.StringPointer(utils.EmptyString)},
utils.TBLVersions: &ItemOptJson{
Ttl: utils.StringPointer(utils.EmptyString)},
},
}
if cfg, err := dfCgrJsonCfg.DbJsonCfg(STORDB_JSN); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(eCfg, cfg) {
t.Error("Received: ", cfg)
t.Errorf("Expected : %+v,\n Received: %+v", utils.ToJSON(eCfg), utils.ToJSON(cfg))
}
}

View File

@@ -619,8 +619,8 @@ func TestConfigSanityDataDB(t *testing.T) {
}
cfg.thresholdSCfg.Enabled = false
cfg.dataDbCfg.Items = map[string]*ItemRmtRplOpt{
"test1": &ItemRmtRplOpt{
cfg.dataDbCfg.Items = map[string]*ItemOpt{
"test1": &ItemOpt{
Remote: true,
},
}
@@ -629,8 +629,8 @@ func TestConfigSanityDataDB(t *testing.T) {
t.Errorf("Expecting: %+q received: %+q", expected, err)
}
cfg.dataDbCfg.Items = map[string]*ItemRmtRplOpt{
"test2": &ItemRmtRplOpt{
cfg.dataDbCfg.Items = map[string]*ItemOpt{
"test2": &ItemOpt{
Remote: false,
Replicate: true,
},

View File

@@ -25,70 +25,229 @@ import (
"time"
"github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/utils"
"github.com/cgrates/ltcache"
)
var unlimitedCfg = &ltcache.CacheConfig{
MaxItems: -1,
}
// internalDBCacheCfg indexes the internal DataDB partitions
var internalDBCacheCfg = map[string]*ltcache.CacheConfig{
utils.CacheDestinations: unlimitedCfg,
utils.CacheReverseDestinations: unlimitedCfg,
utils.CacheActions: unlimitedCfg,
utils.CacheActionPlans: unlimitedCfg,
utils.CacheAccountActionPlans: unlimitedCfg,
utils.CacheActionTriggers: unlimitedCfg,
utils.CacheRatingPlans: unlimitedCfg,
utils.CacheRatingProfiles: unlimitedCfg,
utils.CacheAccounts: unlimitedCfg,
utils.CacheSharedGroups: unlimitedCfg,
utils.TBLVersions: unlimitedCfg,
utils.CacheTimings: unlimitedCfg,
utils.CacheFilters: unlimitedCfg,
utils.CacheResourceProfiles: unlimitedCfg,
utils.CacheResourceFilterIndexes: unlimitedCfg,
utils.CacheResources: unlimitedCfg,
utils.CacheStatFilterIndexes: unlimitedCfg,
utils.CacheStatQueueProfiles: unlimitedCfg,
utils.CacheStatQueues: unlimitedCfg,
utils.CacheThresholdFilterIndexes: unlimitedCfg,
utils.CacheThresholdProfiles: unlimitedCfg,
utils.CacheThresholds: unlimitedCfg,
utils.CacheSupplierFilterIndexes: unlimitedCfg,
utils.CacheSupplierProfiles: unlimitedCfg,
utils.CacheChargerFilterIndexes: unlimitedCfg,
utils.CacheChargerProfiles: unlimitedCfg,
utils.CacheAttributeFilterIndexes: unlimitedCfg,
utils.CacheAttributeProfiles: unlimitedCfg,
utils.CacheDispatcherFilterIndexes: unlimitedCfg,
utils.CacheDispatcherProfiles: unlimitedCfg,
utils.CacheDispatcherHosts: unlimitedCfg,
utils.CacheLoadIDs: unlimitedCfg,
utils.TBLTPTimings: unlimitedCfg,
utils.TBLTPDestinations: unlimitedCfg,
utils.TBLTPRates: unlimitedCfg,
utils.TBLTPDestinationRates: unlimitedCfg,
utils.TBLTPRatingPlans: unlimitedCfg,
utils.TBLTPRateProfiles: unlimitedCfg,
utils.TBLTPSharedGroups: unlimitedCfg,
utils.TBLTPActions: unlimitedCfg,
utils.TBLTPActionTriggers: unlimitedCfg,
utils.TBLTPAccountActions: unlimitedCfg,
utils.TBLTPResources: unlimitedCfg,
utils.TBLTPStats: unlimitedCfg,
utils.TBLTPThresholds: unlimitedCfg,
utils.TBLTPFilters: unlimitedCfg,
utils.SessionCostsTBL: unlimitedCfg,
utils.TBLTPActionPlans: unlimitedCfg,
utils.TBLTPSuppliers: unlimitedCfg,
utils.TBLTPAttributes: unlimitedCfg,
utils.TBLTPChargers: unlimitedCfg,
utils.TBLTPDispatchers: unlimitedCfg,
utils.TBLTPDispatcherHosts: unlimitedCfg,
utils.CDRsTBL: unlimitedCfg,
utils.CacheDestinations: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.CacheDestinations].TTL,
},
utils.CacheReverseDestinations: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.CacheReverseDestinations].TTL,
},
utils.CacheActions: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.CacheActions].TTL,
},
utils.CacheActionPlans: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.CacheActionPlans].TTL,
},
utils.CacheAccountActionPlans: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.CacheAccountActionPlans].TTL,
},
utils.CacheActionTriggers: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.CacheActionTriggers].TTL,
},
utils.CacheRatingPlans: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.CacheRatingPlans].TTL,
},
utils.CacheRatingProfiles: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.CacheRatingProfiles].TTL,
},
utils.CacheAccounts: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.CacheAccounts].TTL,
},
utils.CacheSharedGroups: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.CacheSharedGroups].TTL,
},
utils.TBLVersions: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().StorDbCfg().Items[utils.TBLVersions].TTL,
},
utils.CacheTimings: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.CacheTimings].TTL,
},
utils.CacheFilters: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.CacheFilters].TTL,
},
utils.CacheResourceProfiles: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.CacheResourceProfiles].TTL,
},
utils.CacheResourceFilterIndexes: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.MetaFilterIndexes].TTL,
},
utils.CacheResources: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.CacheResources].TTL,
},
utils.CacheStatFilterIndexes: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.MetaFilterIndexes].TTL,
},
utils.CacheStatQueueProfiles: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.CacheStatQueueProfiles].TTL,
},
utils.CacheStatQueues: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.CacheStatQueues].TTL,
},
utils.CacheThresholdFilterIndexes: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.MetaFilterIndexes].TTL,
},
utils.CacheThresholdProfiles: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.CacheThresholdProfiles].TTL,
},
utils.CacheThresholds: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.CacheThresholds].TTL,
},
utils.CacheSupplierFilterIndexes: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.MetaFilterIndexes].TTL,
},
utils.CacheSupplierProfiles: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.CacheSupplierProfiles].TTL,
},
utils.CacheChargerFilterIndexes: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.MetaFilterIndexes].TTL,
},
utils.CacheChargerProfiles: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.CacheChargerProfiles].TTL,
},
utils.CacheAttributeFilterIndexes: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.MetaFilterIndexes].TTL,
},
utils.CacheAttributeProfiles: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.CacheAttributeProfiles].TTL,
},
utils.CacheDispatcherFilterIndexes: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.MetaFilterIndexes].TTL,
},
utils.CacheDispatcherProfiles: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.CacheDispatcherProfiles].TTL,
},
utils.CacheDispatcherHosts: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.CacheDispatcherHosts].TTL,
},
utils.CacheLoadIDs: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().DataDbCfg().Items[utils.CacheLoadIDs].TTL,
},
utils.TBLTPTimings: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().StorDbCfg().Items[utils.TBLTPTimings].TTL,
},
utils.TBLTPDestinations: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().StorDbCfg().Items[utils.TBLTPDestinations].TTL,
},
utils.TBLTPRates: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().StorDbCfg().Items[utils.TBLTPRates].TTL,
},
utils.TBLTPDestinationRates: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().StorDbCfg().Items[utils.TBLTPDestinationRates].TTL,
},
utils.TBLTPRatingPlans: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().StorDbCfg().Items[utils.TBLTPRatingPlans].TTL,
},
utils.TBLTPRateProfiles: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().StorDbCfg().Items[utils.TBLTPRateProfiles].TTL,
},
utils.TBLTPSharedGroups: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().StorDbCfg().Items[utils.TBLTPSharedGroups].TTL,
},
utils.TBLTPActions: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().StorDbCfg().Items[utils.TBLTPActions].TTL,
},
utils.TBLTPActionTriggers: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().StorDbCfg().Items[utils.TBLTPActionTriggers].TTL,
},
utils.TBLTPAccountActions: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().StorDbCfg().Items[utils.TBLTPAccountActions].TTL,
},
utils.TBLTPResources: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().StorDbCfg().Items[utils.TBLTPResources].TTL,
},
utils.TBLTPStats: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().StorDbCfg().Items[utils.TBLTPStats].TTL,
},
utils.TBLTPThresholds: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().StorDbCfg().Items[utils.TBLTPThresholds].TTL,
},
utils.TBLTPFilters: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().StorDbCfg().Items[utils.TBLTPFilters].TTL,
},
utils.SessionCostsTBL: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().StorDbCfg().Items[utils.SessionCostsTBL].TTL,
},
utils.TBLTPActionPlans: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().StorDbCfg().Items[utils.TBLTPActionPlans].TTL,
},
utils.TBLTPSuppliers: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().StorDbCfg().Items[utils.TBLTPSuppliers].TTL,
},
utils.TBLTPAttributes: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().StorDbCfg().Items[utils.TBLTPAttributes].TTL,
},
utils.TBLTPChargers: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().StorDbCfg().Items[utils.TBLTPChargers].TTL,
},
utils.TBLTPDispatchers: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().StorDbCfg().Items[utils.TBLTPDispatchers].TTL,
},
utils.TBLTPDispatcherHosts: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().StorDbCfg().Items[utils.TBLTPDispatcherHosts].TTL,
},
utils.CDRsTBL: &ltcache.CacheConfig{
MaxItems: -1,
TTL: config.CgrConfig().StorDbCfg().Items[utils.CDRsTBL].TTL,
},
}
type InternalDB struct {
@@ -129,7 +288,7 @@ func (iDB *InternalDB) SetPrefixIndexedFields(prefixIndexedFields []string) {
func (iDB *InternalDB) Close() {}
func (iDB *InternalDB) Flush(_ string) error {
iDB.db = ltcache.NewTransCache(config.CgrConfig().CacheCfg().AsTransCacheConfig())
iDB.db = ltcache.NewTransCache(internalDBCacheCfg)
return nil
}