From 22a2415ca5a9ea8098619fa9bf207609e6af2726 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=AF=E5=A4=A7=E4=BE=A0?= Date: Thu, 15 Jan 2026 12:38:47 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=93=E5=AD=98api=E9=89=B4=E6=9D=83?= =?UTF-8?q?=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/security.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/core/security.py b/app/core/security.py index fc4065e8..b9596c43 100644 --- a/app/core/security.py +++ b/app/core/security.py @@ -17,6 +17,7 @@ from fastapi.security import OAuth2PasswordBearer, APIKeyHeader, APIKeyQuery, AP from passlib.context import CryptContext from app import schemas +from app.core.cache import cached from app.core.config import settings from app.log import logger @@ -66,6 +67,7 @@ def __get_api_key( return key_header or key_query # 首选请求头 +@cached(maxsize=1, ttl=600) def __create_superuser_token_payload() -> schemas.TokenPayload: """ 创建管理员用户的TokenPayload