diff --git a/app/utils/web.py b/app/utils/web.py index 4ab0e877..43340ab2 100644 --- a/app/utils/web.py +++ b/app/utils/web.py @@ -1,5 +1,7 @@ from typing import Optional +from cachetools import TTLCache, cached + from app.utils.http import RequestUtils @@ -73,6 +75,7 @@ class WebUtils: return "" @staticmethod + @cached(cache=TTLCache(maxsize=1, ttl=3600)) def get_bing_wallpaper() -> Optional[str]: """ 获取Bing每日壁纸 @@ -90,6 +93,7 @@ class WebUtils: return None @staticmethod + @cached(cache=TTLCache(maxsize=1, ttl=3600)) def get_bing_wallpapers(num: int = 7) -> Optional[str]: """ 获取7天的Bing每日壁纸