diff --git a/lib/core/common.py b/lib/core/common.py index 52ea24d12..3e7ea6d00 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -76,8 +76,6 @@ from lib.core.settings import SQLITE_ALIASES from lib.core.settings import ACCESS_ALIASES from lib.core.settings import FIREBIRD_ALIASES -__compiledRegularExpressions = {} - def paramToDict(place, parameters=None): """ Split the parameters into names and values, check if these parameters @@ -1305,14 +1303,11 @@ def getCompiledRegex(regex, *args): Returns compiled regular expression and stores it in cache for further usage """ - - global __compiledRegularExpressions - - if (regex, args) in __compiledRegularExpressions: - return __compiledRegularExpressions[(regex, args)] + if (regex, args) in kb.cache.regex: + return kb.cache.regex[(regex, args)] else: retVal = re.compile(regex, *args) - __compiledRegularExpressions[(regex, args)] = retVal + kb.cache.regex[(regex, args)] = retVal return retVal def getPartRun(): diff --git a/lib/core/option.py b/lib/core/option.py index bf1967a57..ac80e22a7 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -928,6 +928,11 @@ def __setKnowledgeBaseAttributes(): kb.absFilePaths = set() kb.bannerFp = advancedDict() + + kb.cache = advancedDict() + kb.cache.regex = {} + kb.cache.md5 = {} + kb.commonOutputs = None kb.data = advancedDict()