refactor: unify module runtime settings

This commit is contained in:
jxxghp
2026-08-24 00:19:57 +08:00
parent 25ad924aac
commit 6b65dc5d12
11 changed files with 148 additions and 30 deletions
+7 -1
View File
@@ -1,10 +1,12 @@
from typing import Tuple, Union
from app.runtime.config import settings
from app.adapters.cache.redis import RedisHelper
from app.modules import _ModuleBase
from app.runtime.settings import RuntimeSettingsCompat
from app.schemas.types import ModuleType, OtherModulesType
settings = RuntimeSettingsCompat()
class RedisModule(_ModuleBase):
"""
@@ -12,10 +14,12 @@ class RedisModule(_ModuleBase):
"""
def init_module(self) -> None:
"""Redis 客户端由缓存 adapter 惰性管理,无需模块级初始化。"""
pass
@staticmethod
def get_name() -> str:
"""返回模块展示名称。"""
return "Redis缓存"
@staticmethod
@@ -40,9 +44,11 @@ class RedisModule(_ModuleBase):
return 0
def init_setting(self) -> Tuple[str, Union[str, bool]]:
"""缓存后端由部署配置决定,不声明独立模块开关。"""
pass
def stop(self) -> None:
"""缓存 adapter 负责连接释放,本模块无独立资源。"""
pass
def test(self):