mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-16 13:49:53 +05:00
Moved ApierV1.Cache methods to CacheSv1 object
This commit is contained in:
committed by
Dan Christian Bogos
parent
8991064faa
commit
040d2ad3c1
@@ -675,443 +675,6 @@ func (self *ApierV1) ReloadScheduler(ignore string, reply *string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *ApierV1) reloadCache(chID string, IDs *[]string) error {
|
||||
var dataIDs []string
|
||||
if IDs == nil {
|
||||
dataIDs = nil // Reload all
|
||||
} else if len(*IDs) > 0 {
|
||||
dataIDs = make([]string, len(*IDs))
|
||||
for idx, dId := range *IDs {
|
||||
dataIDs[idx] = dId
|
||||
}
|
||||
}
|
||||
return self.DataManager.CacheDataFromDB(chID, dataIDs, true)
|
||||
}
|
||||
|
||||
func (self *ApierV1) ReloadCache(attrs utils.AttrReloadCache, reply *string) (err error) {
|
||||
if attrs.FlushAll {
|
||||
engine.Cache.Clear(nil)
|
||||
return
|
||||
}
|
||||
// Reload Destinations
|
||||
if err = self.reloadCache(utils.DESTINATION_PREFIX, attrs.DestinationIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// Reload ReverseDestinations
|
||||
if err = self.reloadCache(utils.REVERSE_DESTINATION_PREFIX, attrs.ReverseDestinationIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// RatingPlans
|
||||
if err = self.reloadCache(utils.RATING_PLAN_PREFIX, attrs.RatingPlanIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// RatingProfiles
|
||||
if err = self.reloadCache(utils.RATING_PROFILE_PREFIX, attrs.RatingProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// Actions
|
||||
if err = self.reloadCache(utils.ACTION_PREFIX, attrs.ActionIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// ActionPlans
|
||||
if err = self.reloadCache(utils.ACTION_PLAN_PREFIX, attrs.ActionPlanIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// AccountActionPlans
|
||||
if err = self.reloadCache(utils.AccountActionPlansPrefix, attrs.AccountActionPlanIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// ActionTriggers
|
||||
if err = self.reloadCache(utils.ACTION_TRIGGER_PREFIX, attrs.ActionTriggerIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// SharedGroups
|
||||
if err = self.reloadCache(utils.SHARED_GROUP_PREFIX, attrs.SharedGroupIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// ResourceProfiles
|
||||
if err = self.reloadCache(utils.ResourceProfilesPrefix, attrs.ResourceProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// Resources
|
||||
if err = self.reloadCache(utils.ResourcesPrefix, attrs.ResourceIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// StatQueues
|
||||
if err = self.reloadCache(utils.StatQueuePrefix, attrs.StatsQueueIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// StatQueueProfiles
|
||||
if err = self.reloadCache(utils.StatQueueProfilePrefix, attrs.StatsQueueProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// Thresholds
|
||||
if err = self.reloadCache(utils.ThresholdPrefix, attrs.ThresholdIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// ThresholdProfiles
|
||||
if err = self.reloadCache(utils.ThresholdProfilePrefix, attrs.ThresholdProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// Filters
|
||||
if err = self.reloadCache(utils.FilterPrefix, attrs.FilterIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// SupplierProfile
|
||||
if err = self.reloadCache(utils.SupplierProfilePrefix, attrs.SupplierProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// AttributeProfile
|
||||
if err = self.reloadCache(utils.AttributeProfilePrefix, attrs.AttributeProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// ChargerProfiles
|
||||
if err = self.reloadCache(utils.ChargerProfilePrefix, attrs.ChargerProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// DispatcherProfile
|
||||
if err = self.reloadCache(utils.DispatcherProfilePrefix, attrs.DispatcherProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
*reply = utils.OK
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *ApierV1) LoadCache(args utils.AttrReloadCache, reply *string) (err error) {
|
||||
if args.FlushAll {
|
||||
engine.Cache.Clear(nil)
|
||||
}
|
||||
var dstIDs, rvDstIDs, rplIDs, rpfIDs, actIDs, aplIDs, aapIDs, atrgIDs, sgIDs, lcrIDs, dcIDs, alsIDs, rvAlsIDs, rspIDs, resIDs, stqIDs, stqpIDs, thIDs, thpIDs, fltrIDs, splpIDs, alsPrfIDs, cppIDs, dppIDs []string
|
||||
if args.DestinationIDs == nil {
|
||||
dstIDs = nil
|
||||
} else {
|
||||
dstIDs = *args.DestinationIDs
|
||||
}
|
||||
if args.ReverseDestinationIDs == nil {
|
||||
rvDstIDs = nil
|
||||
} else {
|
||||
rvDstIDs = *args.ReverseDestinationIDs
|
||||
}
|
||||
if args.RatingPlanIDs == nil {
|
||||
rplIDs = nil
|
||||
} else {
|
||||
rplIDs = *args.RatingPlanIDs
|
||||
}
|
||||
if args.RatingProfileIDs == nil {
|
||||
rpfIDs = nil
|
||||
} else {
|
||||
rpfIDs = *args.RatingProfileIDs
|
||||
}
|
||||
if args.ActionIDs == nil {
|
||||
actIDs = nil
|
||||
} else {
|
||||
actIDs = *args.ActionIDs
|
||||
}
|
||||
if args.ActionPlanIDs == nil {
|
||||
aplIDs = nil
|
||||
} else {
|
||||
aplIDs = *args.ActionPlanIDs
|
||||
}
|
||||
if args.AccountActionPlanIDs == nil {
|
||||
aapIDs = nil
|
||||
} else {
|
||||
aapIDs = *args.AccountActionPlanIDs
|
||||
}
|
||||
if args.ActionTriggerIDs == nil {
|
||||
atrgIDs = nil
|
||||
} else {
|
||||
atrgIDs = *args.ActionTriggerIDs
|
||||
}
|
||||
if args.SharedGroupIDs == nil {
|
||||
sgIDs = nil
|
||||
} else {
|
||||
sgIDs = *args.SharedGroupIDs
|
||||
}
|
||||
if args.ResourceProfileIDs == nil {
|
||||
rspIDs = nil
|
||||
} else {
|
||||
rspIDs = *args.ResourceProfileIDs
|
||||
}
|
||||
if args.ResourceIDs == nil {
|
||||
resIDs = nil
|
||||
} else {
|
||||
resIDs = *args.ResourceIDs
|
||||
}
|
||||
if args.StatsQueueIDs == nil {
|
||||
stqIDs = nil
|
||||
} else {
|
||||
stqIDs = *args.StatsQueueIDs
|
||||
}
|
||||
if args.StatsQueueProfileIDs == nil {
|
||||
stqpIDs = nil
|
||||
} else {
|
||||
stqpIDs = *args.StatsQueueProfileIDs
|
||||
}
|
||||
if args.ThresholdIDs == nil {
|
||||
thIDs = nil
|
||||
} else {
|
||||
thIDs = *args.ThresholdIDs
|
||||
}
|
||||
if args.ThresholdProfileIDs == nil {
|
||||
thpIDs = nil
|
||||
} else {
|
||||
thpIDs = *args.ThresholdProfileIDs
|
||||
}
|
||||
if args.FilterIDs == nil {
|
||||
fltrIDs = nil
|
||||
} else {
|
||||
fltrIDs = *args.FilterIDs
|
||||
}
|
||||
if args.SupplierProfileIDs == nil {
|
||||
splpIDs = nil
|
||||
} else {
|
||||
splpIDs = *args.SupplierProfileIDs
|
||||
}
|
||||
if args.AttributeProfileIDs == nil {
|
||||
alsPrfIDs = nil
|
||||
} else {
|
||||
alsPrfIDs = *args.AttributeProfileIDs
|
||||
}
|
||||
if args.ChargerProfileIDs == nil {
|
||||
cppIDs = nil
|
||||
} else {
|
||||
cppIDs = *args.ChargerProfileIDs
|
||||
}
|
||||
if args.DispatcherProfileIDs == nil {
|
||||
dppIDs = nil
|
||||
} else {
|
||||
dppIDs = *args.DispatcherProfileIDs
|
||||
}
|
||||
if err := self.DataManager.LoadDataDBCache(dstIDs, rvDstIDs, rplIDs,
|
||||
rpfIDs, actIDs, aplIDs, aapIDs, atrgIDs, sgIDs, lcrIDs, dcIDs, alsIDs,
|
||||
rvAlsIDs, rspIDs, resIDs, stqIDs, stqpIDs, thIDs, thpIDs,
|
||||
fltrIDs, splpIDs, alsPrfIDs, cppIDs, dppIDs); err != nil {
|
||||
return utils.NewErrServerError(err)
|
||||
}
|
||||
*reply = utils.OK
|
||||
return nil
|
||||
}
|
||||
|
||||
func flushCache(chID string, IDs *[]string) {
|
||||
if IDs == nil {
|
||||
engine.Cache.Clear([]string{chID})
|
||||
} else if len(*IDs) != 0 {
|
||||
for _, key := range *IDs {
|
||||
engine.Cache.Remove(chID, key, true, utils.NonTransactional)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FlushCache wipes out cache for a prefix or completely
|
||||
func (self *ApierV1) FlushCache(args utils.AttrReloadCache, reply *string) (err error) {
|
||||
if args.FlushAll {
|
||||
engine.Cache.Clear(nil)
|
||||
*reply = utils.OK
|
||||
return
|
||||
}
|
||||
flushCache(utils.CacheDestinations, args.DestinationIDs)
|
||||
flushCache(utils.CacheReverseDestinations, args.ReverseDestinationIDs)
|
||||
flushCache(utils.CacheRatingPlans, args.RatingPlanIDs)
|
||||
flushCache(utils.CacheRatingProfiles, args.RatingProfileIDs)
|
||||
flushCache(utils.CacheActions, args.ActionIDs)
|
||||
flushCache(utils.CacheActionPlans, args.ActionPlanIDs)
|
||||
flushCache(utils.CacheActionTriggers, args.ActionTriggerIDs)
|
||||
flushCache(utils.CacheSharedGroups, args.SharedGroupIDs)
|
||||
flushCache(utils.CacheResourceProfiles, args.ResourceProfileIDs)
|
||||
flushCache(utils.CacheResources, args.ResourceIDs)
|
||||
flushCache(utils.CacheStatQueues, args.StatsQueueIDs)
|
||||
flushCache(utils.CacheThresholdProfiles, args.StatsQueueProfileIDs)
|
||||
flushCache(utils.CacheThresholds, args.ThresholdIDs)
|
||||
flushCache(utils.CacheThresholdProfiles, args.ThresholdProfileIDs)
|
||||
flushCache(utils.CacheFilters, args.FilterIDs)
|
||||
flushCache(utils.CacheSupplierProfiles, args.SupplierProfileIDs)
|
||||
flushCache(utils.CacheAttributeProfiles, args.AttributeProfileIDs)
|
||||
flushCache(utils.CacheChargerProfiles, args.ChargerProfileIDs)
|
||||
flushCache(utils.CacheDispatcherProfiles, args.DispatcherProfileIDs)
|
||||
flushCache(utils.CacheDispatcherRoutes, args.DispatcherRoutesIDs)
|
||||
|
||||
*reply = utils.OK
|
||||
return
|
||||
}
|
||||
|
||||
func (self *ApierV1) GetCacheStats(attrs utils.AttrCacheStats, reply *utils.CacheStats) error {
|
||||
cs := new(utils.CacheStats)
|
||||
cs.Destinations = len(engine.Cache.GetItemIDs(utils.CacheDestinations, ""))
|
||||
cs.ReverseDestinations = len(engine.Cache.GetItemIDs(utils.CacheReverseDestinations, ""))
|
||||
cs.RatingPlans = len(engine.Cache.GetItemIDs(utils.CacheRatingPlans, ""))
|
||||
cs.RatingProfiles = len(engine.Cache.GetItemIDs(utils.CacheRatingProfiles, ""))
|
||||
cs.Actions = len(engine.Cache.GetItemIDs(utils.CacheActions, ""))
|
||||
cs.ActionPlans = len(engine.Cache.GetItemIDs(utils.CacheActionPlans, ""))
|
||||
cs.AccountActionPlans = len(engine.Cache.GetItemIDs(utils.CacheAccountActionPlans, ""))
|
||||
cs.SharedGroups = len(engine.Cache.GetItemIDs(utils.CacheSharedGroups, ""))
|
||||
cs.ResourceProfiles = len(engine.Cache.GetItemIDs(utils.CacheResourceProfiles, ""))
|
||||
cs.Resources = len(engine.Cache.GetItemIDs(utils.CacheResources, ""))
|
||||
cs.StatQueues = len(engine.Cache.GetItemIDs(utils.CacheStatQueues, ""))
|
||||
cs.StatQueueProfiles = len(engine.Cache.GetItemIDs(utils.CacheStatQueueProfiles, ""))
|
||||
cs.Thresholds = len(engine.Cache.GetItemIDs(utils.CacheThresholds, ""))
|
||||
cs.ThresholdProfiles = len(engine.Cache.GetItemIDs(utils.CacheThresholdProfiles, ""))
|
||||
cs.Filters = len(engine.Cache.GetItemIDs(utils.CacheFilters, ""))
|
||||
cs.SupplierProfiles = len(engine.Cache.GetItemIDs(utils.CacheSupplierProfiles, ""))
|
||||
cs.AttributeProfiles = len(engine.Cache.GetItemIDs(utils.CacheAttributeProfiles, ""))
|
||||
cs.ChargerProfiles = len(engine.Cache.GetItemIDs(utils.CacheChargerProfiles, ""))
|
||||
cs.DispatcherProfiles = len(engine.Cache.GetItemIDs(utils.CacheDispatcherProfiles, ""))
|
||||
cs.DispatcherRoutes = len(engine.Cache.GetItemIDs(utils.CacheDispatcherRoutes, ""))
|
||||
|
||||
*reply = *cs
|
||||
return nil
|
||||
}
|
||||
|
||||
func getCacheKeys(chID string, IDs *[]string, paginator utils.Paginator) (ids []string) {
|
||||
if len(*IDs) != 0 {
|
||||
for _, id := range *IDs {
|
||||
if _, hasIt := engine.Cache.Get(chID, id); hasIt {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for _, id := range engine.Cache.GetItemIDs(chID, "") {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
}
|
||||
return paginator.PaginateStringSlice(ids)
|
||||
}
|
||||
|
||||
// GetCacheKeys returns a list of keys available in cache based on query arguments
|
||||
// If keys are provided in arguments, they will be checked for existence
|
||||
func (v1 *ApierV1) GetCacheKeys(args utils.ArgsCacheKeys, reply *utils.ArgsCache) (err error) {
|
||||
if args.DestinationIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheDestinations, args.DestinationIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.DestinationIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.ReverseDestinationIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheReverseDestinations, args.ReverseDestinationIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.ReverseDestinationIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.RatingPlanIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheRatingPlans, args.RatingPlanIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.RatingPlanIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.RatingProfileIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheRatingProfiles, args.RatingProfileIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.RatingProfileIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.ActionIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheActions, args.ActionIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.ActionIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.ActionPlanIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheActionPlans, args.ActionPlanIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.ActionPlanIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.AccountActionPlanIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheAccountActionPlans, args.AccountActionPlanIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.AccountActionPlanIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.ActionTriggerIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheActionTriggers, args.ActionTriggerIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.ActionTriggerIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.SharedGroupIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheSharedGroups, args.SharedGroupIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.SharedGroupIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.ResourceProfileIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheResourceProfiles, args.ResourceProfileIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.ResourceProfileIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.ResourceIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheResources, args.ResourceIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.ResourceIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.StatsQueueIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheStatQueues, args.StatsQueueIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.StatsQueueIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.StatsQueueProfileIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheStatQueueProfiles, args.StatsQueueProfileIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.StatsQueueProfileIDs = &ids
|
||||
}
|
||||
}
|
||||
|
||||
if args.ThresholdIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheThresholds, args.ThresholdIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.ThresholdIDs = &ids
|
||||
}
|
||||
}
|
||||
|
||||
if args.ThresholdProfileIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheThresholdProfiles, args.ThresholdProfileIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.ThresholdProfileIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.FilterIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheFilters, args.FilterIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.FilterIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.SupplierProfileIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheSupplierProfiles, args.SupplierProfileIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.SupplierProfileIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.AttributeProfileIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheAttributeProfiles, args.AttributeProfileIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.AttributeProfileIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.ChargerProfileIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheChargerProfiles, args.ChargerProfileIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.ChargerProfileIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.DispatcherProfileIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheDispatcherProfiles, args.DispatcherProfileIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.DispatcherProfileIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.DispatcherRoutesIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheDispatcherRoutes, args.DispatcherRoutesIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.DispatcherRoutesIDs = &ids
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (self *ApierV1) LoadTariffPlanFromFolder(attrs utils.AttrLoadTpFromFolder, reply *string) error {
|
||||
if len(attrs.FolderPath) == 0 {
|
||||
return fmt.Errorf("%s:%s", utils.ErrMandatoryIeMissing.Error(), "FolderPath")
|
||||
|
||||
@@ -94,6 +94,28 @@ func (chSv1 *CacheSv1) RemoveGroup(args *engine.ArgsGetGroup,
|
||||
return chSv1.cacheS.V1RemoveGroup(args, rply)
|
||||
}
|
||||
|
||||
// ReloadCache reloads cache from DB for a prefix or completely
|
||||
func (chSv1 *CacheSv1) ReloadCache(attrs utils.AttrReloadCache, reply *string) (err error) {
|
||||
return chSv1.cacheS.V1ReloadCache(attrs, reply)
|
||||
}
|
||||
|
||||
// LoadCache loads cache from DB for a prefix or completely
|
||||
func (chSv1 *CacheSv1) LoadCache(args utils.AttrReloadCache, reply *string) (err error) {
|
||||
return chSv1.cacheS.V1LoadCache(args, reply)
|
||||
}
|
||||
|
||||
// FlushCache wipes out cache for a prefix or completely
|
||||
func (chSv1 *CacheSv1) FlushCache(args utils.AttrReloadCache, reply *string) (err error) {
|
||||
return chSv1.cacheS.V1FlushCache(args, reply)
|
||||
}
|
||||
|
||||
// GetCacheKeys returns a list of keys available in cache based on query arguments
|
||||
// If keys are provided in arguments, they will be checked for existence
|
||||
func (chSv1 *CacheSv1) GetCacheKeys(args utils.ArgsCacheKeys, reply *utils.ArgsCache) (err error) {
|
||||
return chSv1.cacheS.V1GetCacheKeys(args, reply)
|
||||
}
|
||||
|
||||
// Ping used to detreminate if component is active
|
||||
func (chSv1 *CacheSv1) Ping(ign *utils.CGREvent, reply *string) error {
|
||||
*reply = utils.Pong
|
||||
return nil
|
||||
|
||||
@@ -81,7 +81,7 @@ func durInternalRater(cd *engine.CallDescriptor) (time.Duration, error) {
|
||||
}
|
||||
defer dm.DataDB().Close()
|
||||
engine.SetDataStorage(dm)
|
||||
if err := dm.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
if err := dm.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil); err != nil {
|
||||
return nilDuration, fmt.Errorf("Cache rating error: %s", err.Error())
|
||||
}
|
||||
|
||||
328
engine/caches.go
328
engine/caches.go
@@ -223,3 +223,331 @@ func (chS *CacheS) V1RemoveGroup(args *ArgsGetGroup,
|
||||
*rply = utils.OK
|
||||
return
|
||||
}
|
||||
|
||||
func (chS *CacheS) reloadCache(chID string, IDs *[]string) error {
|
||||
if IDs == nil {
|
||||
return chS.dm.CacheDataFromDB(chID, nil, true) // Reload all
|
||||
}
|
||||
return chS.dm.CacheDataFromDB(chID, *IDs, true)
|
||||
}
|
||||
|
||||
func (chS *CacheS) V1ReloadCache(attrs utils.AttrReloadCache, reply *string) (err error) {
|
||||
if attrs.FlushAll {
|
||||
Cache.Clear(nil)
|
||||
return
|
||||
}
|
||||
// Reload Destinations
|
||||
if err = chS.reloadCache(utils.DESTINATION_PREFIX, attrs.DestinationIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// Reload ReverseDestinations
|
||||
if err = chS.reloadCache(utils.REVERSE_DESTINATION_PREFIX, attrs.ReverseDestinationIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// RatingPlans
|
||||
if err = chS.reloadCache(utils.RATING_PLAN_PREFIX, attrs.RatingPlanIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// RatingProfiles
|
||||
if err = chS.reloadCache(utils.RATING_PROFILE_PREFIX, attrs.RatingProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// Actions
|
||||
if err = chS.reloadCache(utils.ACTION_PREFIX, attrs.ActionIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// ActionPlans
|
||||
if err = chS.reloadCache(utils.ACTION_PLAN_PREFIX, attrs.ActionPlanIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// AccountActionPlans
|
||||
if err = chS.reloadCache(utils.AccountActionPlansPrefix, attrs.AccountActionPlanIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// ActionTriggers
|
||||
if err = chS.reloadCache(utils.ACTION_TRIGGER_PREFIX, attrs.ActionTriggerIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// SharedGroups
|
||||
if err = chS.reloadCache(utils.SHARED_GROUP_PREFIX, attrs.SharedGroupIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// ResourceProfiles
|
||||
if err = chS.reloadCache(utils.ResourceProfilesPrefix, attrs.ResourceProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// Resources
|
||||
if err = chS.reloadCache(utils.ResourcesPrefix, attrs.ResourceIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// StatQueues
|
||||
if err = chS.reloadCache(utils.StatQueuePrefix, attrs.StatsQueueIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// StatQueueProfiles
|
||||
if err = chS.reloadCache(utils.StatQueueProfilePrefix, attrs.StatsQueueProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// Thresholds
|
||||
if err = chS.reloadCache(utils.ThresholdPrefix, attrs.ThresholdIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// ThresholdProfiles
|
||||
if err = chS.reloadCache(utils.ThresholdProfilePrefix, attrs.ThresholdProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// Filters
|
||||
if err = chS.reloadCache(utils.FilterPrefix, attrs.FilterIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// SupplierProfile
|
||||
if err = chS.reloadCache(utils.SupplierProfilePrefix, attrs.SupplierProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// AttributeProfile
|
||||
if err = chS.reloadCache(utils.AttributeProfilePrefix, attrs.AttributeProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// ChargerProfiles
|
||||
if err = chS.reloadCache(utils.ChargerProfilePrefix, attrs.ChargerProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
// DispatcherProfile
|
||||
if err = chS.reloadCache(utils.DispatcherProfilePrefix, attrs.DispatcherProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
*reply = utils.OK
|
||||
return nil
|
||||
}
|
||||
|
||||
func toStringSlice(in *[]string) []string {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
return *in
|
||||
}
|
||||
|
||||
func (chS *CacheS) V1LoadCache(args utils.AttrReloadCache, reply *string) (err error) {
|
||||
if args.FlushAll {
|
||||
Cache.Clear(nil)
|
||||
}
|
||||
if err := chS.dm.LoadDataDBCache(
|
||||
toStringSlice(args.DestinationIDs),
|
||||
toStringSlice(args.ReverseDestinationIDs),
|
||||
toStringSlice(args.RatingPlanIDs),
|
||||
toStringSlice(args.RatingProfileIDs),
|
||||
toStringSlice(args.ActionIDs),
|
||||
toStringSlice(args.ActionPlanIDs),
|
||||
toStringSlice(args.AccountActionPlanIDs),
|
||||
toStringSlice(args.ActionTriggerIDs),
|
||||
toStringSlice(args.SharedGroupIDs),
|
||||
toStringSlice(args.ResourceProfileIDs),
|
||||
toStringSlice(args.ResourceIDs),
|
||||
toStringSlice(args.StatsQueueIDs),
|
||||
toStringSlice(args.StatsQueueProfileIDs),
|
||||
toStringSlice(args.ThresholdIDs),
|
||||
toStringSlice(args.ThresholdProfileIDs),
|
||||
toStringSlice(args.FilterIDs),
|
||||
toStringSlice(args.SupplierProfileIDs),
|
||||
toStringSlice(args.AttributeProfileIDs),
|
||||
toStringSlice(args.ChargerProfileIDs),
|
||||
toStringSlice(args.DispatcherProfileIDs),
|
||||
); err != nil {
|
||||
return utils.NewErrServerError(err)
|
||||
}
|
||||
*reply = utils.OK
|
||||
return nil
|
||||
}
|
||||
|
||||
func flushCache(chID string, IDs *[]string) {
|
||||
if IDs == nil {
|
||||
Cache.Clear([]string{chID})
|
||||
return
|
||||
}
|
||||
for _, key := range *IDs {
|
||||
Cache.Remove(chID, key, true, utils.NonTransactional)
|
||||
}
|
||||
}
|
||||
|
||||
// FlushCache wipes out cache for a prefix or completely
|
||||
func (chS *CacheS) V1FlushCache(args utils.AttrReloadCache, reply *string) (err error) {
|
||||
if args.FlushAll {
|
||||
Cache.Clear(nil)
|
||||
*reply = utils.OK
|
||||
return
|
||||
}
|
||||
flushCache(utils.CacheDestinations, args.DestinationIDs)
|
||||
flushCache(utils.CacheReverseDestinations, args.ReverseDestinationIDs)
|
||||
flushCache(utils.CacheRatingPlans, args.RatingPlanIDs)
|
||||
flushCache(utils.CacheRatingProfiles, args.RatingProfileIDs)
|
||||
flushCache(utils.CacheActions, args.ActionIDs)
|
||||
flushCache(utils.CacheActionPlans, args.ActionPlanIDs)
|
||||
flushCache(utils.CacheActionTriggers, args.ActionTriggerIDs)
|
||||
flushCache(utils.CacheSharedGroups, args.SharedGroupIDs)
|
||||
flushCache(utils.CacheResourceProfiles, args.ResourceProfileIDs)
|
||||
flushCache(utils.CacheResources, args.ResourceIDs)
|
||||
flushCache(utils.CacheStatQueues, args.StatsQueueIDs)
|
||||
flushCache(utils.CacheThresholdProfiles, args.StatsQueueProfileIDs)
|
||||
flushCache(utils.CacheThresholds, args.ThresholdIDs)
|
||||
flushCache(utils.CacheThresholdProfiles, args.ThresholdProfileIDs)
|
||||
flushCache(utils.CacheFilters, args.FilterIDs)
|
||||
flushCache(utils.CacheSupplierProfiles, args.SupplierProfileIDs)
|
||||
flushCache(utils.CacheAttributeProfiles, args.AttributeProfileIDs)
|
||||
flushCache(utils.CacheChargerProfiles, args.ChargerProfileIDs)
|
||||
flushCache(utils.CacheDispatcherProfiles, args.DispatcherProfileIDs)
|
||||
flushCache(utils.CacheDispatcherRoutes, args.DispatcherRoutesIDs)
|
||||
|
||||
*reply = utils.OK
|
||||
return
|
||||
}
|
||||
|
||||
func getCacheKeys(chID string, IDs *[]string, paginator utils.Paginator) (ids []string) {
|
||||
if len(*IDs) != 0 {
|
||||
for _, id := range *IDs {
|
||||
if _, hasIt := Cache.Get(chID, id); hasIt {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for _, id := range Cache.GetItemIDs(chID, "") {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
}
|
||||
return paginator.PaginateStringSlice(ids)
|
||||
}
|
||||
|
||||
// GetCacheKeys returns a list of keys available in cache based on query arguments
|
||||
// If keys are provided in arguments, they will be checked for existence
|
||||
func (chS *CacheS) V1GetCacheKeys(args utils.ArgsCacheKeys, reply *utils.ArgsCache) (err error) {
|
||||
if args.DestinationIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheDestinations, args.DestinationIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.DestinationIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.ReverseDestinationIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheReverseDestinations, args.ReverseDestinationIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.ReverseDestinationIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.RatingPlanIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheRatingPlans, args.RatingPlanIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.RatingPlanIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.RatingProfileIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheRatingProfiles, args.RatingProfileIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.RatingProfileIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.ActionIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheActions, args.ActionIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.ActionIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.ActionPlanIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheActionPlans, args.ActionPlanIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.ActionPlanIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.AccountActionPlanIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheAccountActionPlans, args.AccountActionPlanIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.AccountActionPlanIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.ActionTriggerIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheActionTriggers, args.ActionTriggerIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.ActionTriggerIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.SharedGroupIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheSharedGroups, args.SharedGroupIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.SharedGroupIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.ResourceProfileIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheResourceProfiles, args.ResourceProfileIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.ResourceProfileIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.ResourceIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheResources, args.ResourceIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.ResourceIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.StatsQueueIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheStatQueues, args.StatsQueueIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.StatsQueueIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.StatsQueueProfileIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheStatQueueProfiles, args.StatsQueueProfileIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.StatsQueueProfileIDs = &ids
|
||||
}
|
||||
}
|
||||
|
||||
if args.ThresholdIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheThresholds, args.ThresholdIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.ThresholdIDs = &ids
|
||||
}
|
||||
}
|
||||
|
||||
if args.ThresholdProfileIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheThresholdProfiles, args.ThresholdProfileIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.ThresholdProfileIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.FilterIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheFilters, args.FilterIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.FilterIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.SupplierProfileIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheSupplierProfiles, args.SupplierProfileIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.SupplierProfileIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.AttributeProfileIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheAttributeProfiles, args.AttributeProfileIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.AttributeProfileIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.ChargerProfileIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheChargerProfiles, args.ChargerProfileIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.ChargerProfileIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.DispatcherProfileIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheDispatcherProfiles, args.DispatcherProfileIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.DispatcherProfileIDs = &ids
|
||||
}
|
||||
}
|
||||
if args.DispatcherRoutesIDs != nil {
|
||||
ids := getCacheKeys(utils.CacheDispatcherRoutes, args.DispatcherRoutesIDs, args.Paginator)
|
||||
if len(ids) != 0 {
|
||||
reply.DispatcherRoutesIDs = &ids
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -108,8 +108,8 @@ func (dm *DataManager) DataDB() DataDB {
|
||||
}
|
||||
|
||||
func (dm *DataManager) LoadDataDBCache(dstIDs, rvDstIDs, rplIDs, rpfIDs, actIDs, aplIDs,
|
||||
aaPlIDs, atrgIDs, sgIDs, lcrIDs, dcIDs, alsIDs, rvAlsIDs, rpIDs, resIDs,
|
||||
stqIDs, stqpIDs, thIDs, thpIDs, fltrIDs, splPrflIDs, alsPrfIDs, cppIDs, dppIDs []string) (err error) {
|
||||
aaPlIDs, atrgIDs, sgIDs, rpIDs, resIDs, stqIDs, stqpIDs, thIDs, thpIDs, fltrIDs,
|
||||
splPrflIDs, alsPrfIDs, cppIDs, dppIDs []string) (err error) {
|
||||
if dm.DataDB().GetStorageType() == utils.MAPSTOR {
|
||||
if dm.cacheCfg == nil {
|
||||
return
|
||||
|
||||
@@ -64,9 +64,8 @@ ENABLE_ACNT,*enable_account,,,,,,,,,,,,,false,false,10`
|
||||
csvr.WriteToDatabase(false, false, false)
|
||||
|
||||
engine.Cache.Clear(nil)
|
||||
dbAcntActs.LoadDataDBCache(nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
dbAcntActs.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
|
||||
expectAcnt := &engine.Account{ID: "cgrates.org:1"}
|
||||
if acnt, err := dbAcntActs.DataDB().GetAccount("cgrates.org:1"); err != nil {
|
||||
|
||||
@@ -76,9 +76,8 @@ cgrates.org,call,*any,2013-01-06T00:00:00Z,RP_ANY,`
|
||||
}
|
||||
|
||||
engine.Cache.Clear(nil)
|
||||
dbAuth.LoadDataDBCache(nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
dbAuth.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
|
||||
if cachedDests := len(engine.Cache.GetItemIDs(utils.CacheDestinations, "")); cachedDests != 0 {
|
||||
t.Error("Wrong number of cached destinations found", cachedDests)
|
||||
|
||||
@@ -76,9 +76,8 @@ cgrates.org,sms,*any,2012-01-01T00:00:00Z,RP_SMS1,`
|
||||
}
|
||||
csvr.WriteToDatabase(false, false, false)
|
||||
engine.Cache.Clear(nil)
|
||||
dataDB.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil)
|
||||
dataDB.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
|
||||
if cachedRPlans := len(engine.Cache.GetItemIDs(utils.CacheRatingPlans, "")); cachedRPlans != 3 {
|
||||
t.Error("Wrong number of cached rating plans found", cachedRPlans)
|
||||
|
||||
@@ -60,9 +60,8 @@ RP_DATA1,DR_DATA_2,TM2,10`
|
||||
}
|
||||
csvr.WriteToDatabase(false, false, false)
|
||||
engine.Cache.Clear(nil)
|
||||
dataDB.LoadDataDBCache(nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
dataDB.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
|
||||
if cachedRPlans := len(engine.Cache.GetItemIDs(utils.CacheRatingPlans, "")); cachedRPlans != 1 {
|
||||
t.Error("Wrong number of cached rating plans found", cachedRPlans)
|
||||
|
||||
@@ -108,9 +108,8 @@ TOPUP10_AT,TOPUP10_AC1,ASAP,10`
|
||||
}
|
||||
engine.Cache.Clear(nil)
|
||||
|
||||
dataDB.LoadDataDBCache(nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
dataDB.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
|
||||
if cachedDests := len(engine.Cache.GetItemIDs(utils.CacheDestinations, "")); cachedDests != 0 {
|
||||
t.Error("Wrong number of cached destinations found", cachedDests)
|
||||
|
||||
@@ -105,9 +105,8 @@ TOPUP10_AT,TOPUP10_AC1,ASAP,10`
|
||||
t.Error("No account saved")
|
||||
}
|
||||
engine.Cache.Clear(nil)
|
||||
dataDB2.LoadDataDBCache(nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
dataDB2.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
|
||||
if cachedDests := len(engine.Cache.GetItemIDs(utils.CacheDestinations, "")); cachedDests != 0 {
|
||||
t.Error("Wrong number of cached destinations found", cachedDests)
|
||||
|
||||
@@ -104,9 +104,8 @@ cgrates.org,call,discounted_minutes,2013-01-06T00:00:00Z,RP_UK_Mobile_BIG5_PKG,`
|
||||
t.Error("No account saved")
|
||||
}
|
||||
engine.Cache.Clear(nil)
|
||||
dataDB3.LoadDataDBCache(nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
dataDB3.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
|
||||
if cachedDests := len(engine.Cache.GetItemIDs(utils.CacheDestinations, "")); cachedDests != 0 {
|
||||
t.Error("Wrong number of cached destinations found", cachedDests)
|
||||
|
||||
@@ -58,9 +58,8 @@ func TestSMSLoadCsvTpSmsChrg1(t *testing.T) {
|
||||
}
|
||||
csvr.WriteToDatabase(false, false, false)
|
||||
engine.Cache.Clear(nil)
|
||||
dataDB.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
dataDB.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
|
||||
if cachedRPlans := len(engine.Cache.GetItemIDs(utils.CacheRatingPlans, "")); cachedRPlans != 1 {
|
||||
t.Error("Wrong number of cached rating plans found", cachedRPlans)
|
||||
|
||||
Reference in New Issue
Block a user