为抽卡模拟器添加缓存

This commit is contained in:
洛水居室 2022-10-15 21:10:37 +08:00
parent 6a2096d1ea
commit 8c9a13c61f
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC

View File

@ -103,12 +103,14 @@ def game_id_to_role_id(gid: str) -> int | None:
)
@functools.lru_cache()
def weapon_to_game_id(name: str) -> Optional[int]:
return next(
(int(key) for key, value in WEAPON_DATA.items() if value['name'] == name), None
)
@functools.lru_cache()
def avatar_to_game_id(name: str) -> Optional[int]:
return next(
(int(key) for key, value in AVATAR_DATA.items() if value['name'] == name), None