fix tmdb lru cache

This commit is contained in:
jxxghp 2023-10-05 17:41:02 -07:00
parent 2ee477c35e
commit 79c7475435

View File

@ -3,6 +3,7 @@
import logging import logging
import os import os
import time import time
from datetime import datetime
from functools import lru_cache from functools import lru_cache
import requests import requests
@ -137,7 +138,11 @@ class TMDb(object):
os.environ[self.TMDB_CACHE_ENABLED] = str(cache) os.environ[self.TMDB_CACHE_ENABLED] = str(cache)
@lru_cache(maxsize=REQUEST_CACHE_MAXSIZE) @lru_cache(maxsize=REQUEST_CACHE_MAXSIZE)
def cached_request(self, method, url, data, json): def cached_request(self, method, url, data, json,
_ts=datetime.strftime(datetime.now(), '%Y%m%d')):
"""
缓存请求时间默认1天
"""
return self.request(method, url, data, json) return self.request(method, url, data, json)
def request(self, method, url, data, json): def request(self, method, url, data, json):