fix token

This commit is contained in:
咕谷酱
2025-08-18 17:41:10 +08:00
parent 7f512cec6e
commit b3fff65e35
3 changed files with 186 additions and 42 deletions

View File

@@ -38,10 +38,10 @@ class BeatmapRawFetcher(BaseFetcher):
self, redis: redis.Redis, beatmap_id: int
) -> str:
from app.config import settings
cache_key = f"beatmap:{beatmap_id}:raw"
cache_expire = settings.beatmap_cache_expire_hours * 60 * 60
# 检查缓存
if await redis.exists(cache_key):
content = await redis.get(cache_key)
@@ -49,7 +49,7 @@ class BeatmapRawFetcher(BaseFetcher):
# 延长缓存时间
await redis.expire(cache_key, cache_expire)
return content # pyright: ignore[reportReturnType]
# 获取并缓存
raw = await self.get_beatmap_raw(beatmap_id)
await redis.set(cache_key, raw, ex=cache_expire)