feat(recalculate): add --additional-count & --max-cached-beatmaps-count to batch calculate

This commit is contained in:
MingxuanGame
2025-11-08 18:31:00 +00:00
parent 5c2687e1e4
commit a46b17fce4
2 changed files with 126 additions and 4 deletions

View File

@@ -257,3 +257,11 @@ async def calculate_beatmap_attributes(
attr = await get_calculator().calculate_difficulty(resp, mods_, ruleset)
await redis.set(key, attr.model_dump_json())
return attr
async def clear_cached_beatmap_raws(redis: Redis, beatmaps: list[int] = []):
if beatmaps:
keys = [f"beatmap:{bid}:raw" for bid in beatmaps]
await redis.delete(*keys)
return
await redis.delete("beatmap:*:raw")