fix #2151 TMDB发现和趋势修改为TTL缓存

This commit is contained in:
jxxghp
2024-05-24 09:29:51 +08:00
parent 6ee6de48ff
commit a278c80951
3 changed files with 13 additions and 3 deletions

View File

@ -1,14 +1,21 @@
from cachetools import cached, TTLCache
from ..tmdb import TMDb
class Trending(TMDb):
_urls = {"trending": "/trending/%s/%s"}
@cached(cache=TTLCache(maxsize=1, ttl=43200))
def _trending(self, media_type="all", time_window="day", page=1):
"""
Get trending, TTLCache 12 hours
"""
return self._request_obj(
self._urls["trending"] % (media_type, time_window),
params="page=%s" % page,
key="results",
call_cached=False
)
def all_day(self, page=1):