Add Redis-backed cache backend with env switch

This commit is contained in:
Chris
2026-04-03 02:38:54 +08:00
parent 55e640f2fb
commit 73ed4ff0ff
6 changed files with 133 additions and 7 deletions

View File

@@ -35,6 +35,10 @@ class Settings(BaseSettings):
public_frontend_origins: Annotated[list[str], NoDecode] = ["https://member.ose.tw"]
internal_shared_secret: str = ""
admin_required_groups: Annotated[list[str], NoDecode] = []
cache_backend: str = "memory"
cache_redis_url: str = "redis://127.0.0.1:6379/0"
cache_prefix: str = "memberapi"
cache_default_ttl_seconds: int = 30
@field_validator("public_frontend_origins", mode="before")
@classmethod