Skip to content

Commit 9dbdfe2

Browse files
小调整
1 parent 0701806 commit 9dbdfe2

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

apps/application/flow/compare/regex_compare.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from application.flow.compare import Compare
1313
from common.cache.mem_cache import MemCache
1414

15+
1516
match_cache = MemCache('regex', {
1617
'TIMEOUT': 3600, # 缓存有效期为 1 小时
1718
'OPTIONS': {

apps/application/flow/compare/wildcard_compare.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from application.flow.compare import Compare
1414
from common.cache.mem_cache import MemCache
1515

16+
1617
match_cache = MemCache('wildcard_to_regex', {
1718
'TIMEOUT': 3600, # 缓存有效期为 1 小时
1819
'OPTIONS': {
@@ -21,7 +22,7 @@
2122
},
2223
})
2324

24-
# 转成正则执行,性能更高
25+
2526
def translate_and_compile_and_cache(wildcard):
2627
match = match_cache.get(wildcard)
2728
if not match:
@@ -37,6 +38,6 @@ def support(self, node_id, fields: List[str], source_value, compare, target_valu
3738
return True
3839

3940
def compare(self, source_value, compare, target_value):
40-
# 转成正则执行,性能更高
41+
# 转成正则,性能更高
4142
match = translate_and_compile_and_cache(str(target_value))
4243
return bool(match(str(source_value)))

0 commit comments

Comments
 (0)