清理表情

This commit is contained in:
2026-01-31 18:00:05 +08:00
parent 674f48c74b
commit 5eb13324c2
15 changed files with 394 additions and 156 deletions

View File

@@ -42,7 +42,7 @@ class CacheManager:
with open(cache_path, 'rb') as f:
return pickle.load(f)
except Exception as e:
print(f"⚠️ 读取缓存失败: {e}")
print(f"[WARN] 读取缓存失败: {e}")
return None
return None
@@ -56,14 +56,14 @@ class CacheManager:
with open(cache_path, 'wb') as f:
pickle.dump(value, f)
except Exception as e:
print(f"⚠️ 写入缓存失败: {e}")
print(f"[WARN] 写入缓存失败: {e}")
def clear(self) -> None:
"""清空所有缓存"""
if self.cache_dir.exists():
for cache_file in self.cache_dir.glob("*.pkl"):
cache_file.unlink()
print(" 缓存已清空")
print("[OK] 缓存已清空")
def cached(self, key_func: Optional[Callable] = None):
"""缓存装饰器"""
@@ -82,7 +82,7 @@ class CacheManager:
# 尝试从缓存获取
cached_value = self.get(cache_key)
if cached_value is not None:
print(f"💾 使用缓存: {cache_key[:8]}...")
print(f"[CACHE] 使用缓存: {cache_key[:8]}...")
return cached_value
# 执行函数并缓存结果