diff --git a/engine/storage_mongo_datadb.go b/engine/storage_mongo_datadb.go index 8289b009e..b1f1300d6 100755 --- a/engine/storage_mongo_datadb.go +++ b/engine/storage_mongo_datadb.go @@ -493,7 +493,7 @@ func (ms *MongoStorage) CacheDataFromDB(prfx string, ids []string, mustBeCached if cCfg, has := ms.cacheCfg[utils.CachePrefixToInstance[prfx]]; has { nrItems = cCfg.Limit } - if nrItems != 0 && nrItems < len(ids) { // More ids than cache config allows it, limit here + if nrItems > 0 && nrItems < len(ids) { // More ids than cache config allows it, limit here ids = ids[:nrItems] } } diff --git a/engine/storage_redis.go b/engine/storage_redis.go index 93aefa3ce..37eee94d7 100755 --- a/engine/storage_redis.go +++ b/engine/storage_redis.go @@ -257,7 +257,7 @@ func (rs *RedisStorage) CacheDataFromDB(prfx string, ids []string, mustBeCached if cCfg, has := rs.cacheCfg[utils.CachePrefixToInstance[prfx]]; has { nrItems = cCfg.Limit } - if nrItems != 0 && nrItems < len(ids) { + if nrItems > 0 && nrItems < len(ids) { ids = ids[:nrItems] } }