modify: Cache TypedDict 对齐 chongming-cache 双后端配置(backend/redis_* NotRequired)
This commit is contained in:
@@ -5,10 +5,10 @@ from typing import TypedDict, Literal, Optional, cast, List, Dict, Any
|
||||
# 根据Python版本选择合适的TOML解析库和Required类型
|
||||
if sys.version_info >= (3, 11):
|
||||
import tomllib
|
||||
from typing import Required
|
||||
from typing import NotRequired, Required
|
||||
else:
|
||||
import tomli as tomllib
|
||||
from typing_extensions import Required
|
||||
from typing_extensions import NotRequired, Required
|
||||
|
||||
|
||||
# ============================================================
|
||||
@@ -227,9 +227,15 @@ class Scheduler(TypedDict):
|
||||
|
||||
|
||||
class Cache(TypedDict):
|
||||
"""缓存系统配置"""
|
||||
"""缓存系统配置(chongming-cache 双后端:diskcache / redis)"""
|
||||
|
||||
cache_store_path: str
|
||||
backend: NotRequired[str]
|
||||
cache_store_path: Required[str]
|
||||
redis_host: NotRequired[str]
|
||||
redis_port: NotRequired[int]
|
||||
redis_db: NotRequired[int]
|
||||
redis_password: NotRequired[str]
|
||||
redis_prefix: NotRequired[str]
|
||||
|
||||
|
||||
class Config(TypedDict):
|
||||
|
||||
Reference in New Issue
Block a user