增加清空缓存的方法

This commit is contained in:
xunbu
2025-07-15 11:28:50 +08:00
parent cbe54555ac
commit afb64ffaae

View File

@@ -1,5 +1,8 @@
import os
from docutranslate.converter import Document from docutranslate.converter import Document
# DOCUTRANSLATE_CHACHE_NUM=os.getenv("DOCUTRANSLATE_CHACHE_NUM")
class DocumentCacher: class DocumentCacher:
def __init__(self): def __init__(self):
@@ -17,5 +20,8 @@ class DocumentCacher:
self.cache_dict[hash_code] = result self.cache_dict[hash_code] = result
return result return result
def clear(self):
self.cache_dict.clear()
document_cacher_global = DocumentCacher() document_cacher_global = DocumentCacher()