Refactor and translate comments and docstrings in utility modules to English for better clarity and maintainability. Update Gunicorn and application startup messages for consistency in language. Enhance documentation with English translations for better accessibility.

This commit is contained in:
dienakdz
2026-04-06 16:47:36 +07:00
parent 3ca291a346
commit 11e2e5aaa6
64 changed files with 2323 additions and 2336 deletions
+5 -5
View File
@@ -15,7 +15,7 @@ logger = get_logger(__name__)
class MemoryCache:
"""内存缓存(Redis 不可用时的备选方案)"""
"""In-memory cache (an alternative if Redis is unavailable)"""
def __init__(self):
self._cache = {}
@@ -47,7 +47,7 @@ class MemoryCache:
class CacheManager:
"""缓存管理器"""
"""cache manager"""
_instance = None
_lock = threading.Lock()
@@ -98,7 +98,7 @@ class CacheManager:
self._use_redis = False
def get(self, key: str) -> Optional[Any]:
"""获取缓存"""
"""Get cache"""
try:
data = self._client.get(key)
if data:
@@ -109,14 +109,14 @@ class CacheManager:
return None
def set(self, key: str, value: Any, ttl: int = 300):
"""设置缓存"""
"""Set up cache"""
try:
self._client.setex(key, ttl, json.dumps(value))
except Exception as e:
logger.error(f"Cache write failed: {e}")
def delete(self, key: str):
"""删除缓存"""
"""Delete cache"""
try:
self._client.delete(key)
except Exception as e: