mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-21 15:18:44 +05:00
71 lines
2.4 KiB
Go
71 lines
2.4 KiB
Go
/*
|
|
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
|
|
Copyright (C) ITsysCOM GmbH
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
*/
|
|
|
|
package v1
|
|
|
|
import (
|
|
"github.com/cgrates/cgrates/config"
|
|
"github.com/cgrates/cgrates/utils"
|
|
)
|
|
|
|
// GetCacheOpt receive the apiOpt and compare with default value
|
|
// overwrite the default if it's present
|
|
// visible in APIerSv2
|
|
func GetCacheOpt(apiOpt *string) string {
|
|
cacheOpt := config.CgrConfig().GeneralCfg().DefaultCaching
|
|
if apiOpt != nil && *apiOpt != utils.EmptyString {
|
|
cacheOpt = *apiOpt
|
|
}
|
|
return cacheOpt
|
|
}
|
|
|
|
// composeArgsReload add the ItemID to AttrReloadCache
|
|
// for a specific CacheID
|
|
func composeArgsReload(args utils.ArgsGetCacheItem) (rpl map[string][]string) {
|
|
rpl = make(map[string][]string)
|
|
switch args.CacheID {
|
|
case utils.CacheResourceProfiles:
|
|
rpl[utils.ResourceProfileIDs] = []string{args.ItemID}
|
|
case utils.CacheResources:
|
|
rpl[utils.ResourceIDs] = []string{args.ItemID}
|
|
case utils.CacheStatQueues:
|
|
rpl[utils.StatsQueueIDs] = []string{args.ItemID}
|
|
case utils.CacheStatQueueProfiles:
|
|
rpl[utils.StatsQueueProfileIDs] = []string{args.ItemID}
|
|
case utils.CacheThresholds:
|
|
rpl[utils.ThresholdIDs] = []string{args.ItemID}
|
|
case utils.CacheThresholdProfiles:
|
|
rpl[utils.ThresholdProfileIDs] = []string{args.ItemID}
|
|
case utils.CacheFilters:
|
|
rpl[utils.FilterIDs] = []string{args.ItemID}
|
|
case utils.CacheRouteProfiles:
|
|
rpl[utils.RouteProfileIDs] = []string{args.ItemID}
|
|
case utils.CacheAttributeProfiles:
|
|
rpl[utils.AttributeProfileIDs] = []string{args.ItemID}
|
|
case utils.CacheChargerProfiles:
|
|
rpl[utils.ChargerProfileIDs] = []string{args.ItemID}
|
|
case utils.CacheDispatcherProfiles:
|
|
rpl[utils.DispatcherProfileIDs] = []string{args.ItemID}
|
|
case utils.CacheDispatcherHosts:
|
|
rpl[utils.DispatcherHostIDs] = []string{args.ItemID}
|
|
case utils.CacheRateProfiles:
|
|
rpl[utils.RateProfileIDs] = []string{args.ItemID}
|
|
}
|
|
return
|
|
}
|