mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 15:38:19 +08:00
fix cache
This commit is contained in:
+2
-2
@@ -85,8 +85,8 @@ class ConfigModel(BaseModel):
|
|||||||
DB_ECHO: bool = False
|
DB_ECHO: bool = False
|
||||||
# 数据库连接池类型,QueuePool, NullPool
|
# 数据库连接池类型,QueuePool, NullPool
|
||||||
DB_POOL_TYPE: str = "QueuePool"
|
DB_POOL_TYPE: str = "QueuePool"
|
||||||
# 是否在获取连接时进行预先 ping 操作,默认关闭
|
# 是否在获取连接时进行预先 ping 操作
|
||||||
DB_POOL_PRE_PING: bool = False
|
DB_POOL_PRE_PING: bool = True
|
||||||
# 数据库连接的回收时间(秒)
|
# 数据库连接的回收时间(秒)
|
||||||
DB_POOL_RECYCLE: int = 300
|
DB_POOL_RECYCLE: int = 300
|
||||||
# 数据库连接池获取连接的超时时间(秒)
|
# 数据库连接池获取连接的超时时间(秒)
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import threading
|
|||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
import uuid
|
import uuid
|
||||||
from functools import lru_cache
|
|
||||||
from queue import Empty, PriorityQueue
|
from queue import Empty, PriorityQueue
|
||||||
from typing import Callable, Dict, List, Optional, Union
|
from typing import Callable, Dict, List, Optional, Union
|
||||||
|
|
||||||
@@ -263,7 +262,6 @@ class EventManager(metaclass=Singleton):
|
|||||||
return handler_info
|
return handler_info
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@lru_cache(maxsize=1000)
|
|
||||||
def __get_handler_identifier(cls, target: Union[Callable, type]) -> Optional[str]:
|
def __get_handler_identifier(cls, target: Union[Callable, type]) -> Optional[str]:
|
||||||
"""
|
"""
|
||||||
获取处理器或处理器类的唯一标识符,包括模块名和类名/方法名
|
获取处理器或处理器类的唯一标识符,包括模块名和类名/方法名
|
||||||
@@ -279,7 +277,6 @@ class EventManager(metaclass=Singleton):
|
|||||||
return f"{module_name}.{qualname}"
|
return f"{module_name}.{qualname}"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@lru_cache(maxsize=1000)
|
|
||||||
def __get_class_from_callable(cls, handler: Callable) -> Optional[str]:
|
def __get_class_from_callable(cls, handler: Callable) -> Optional[str]:
|
||||||
"""
|
"""
|
||||||
获取可调用对象所属类的唯一标识符
|
获取可调用对象所属类的唯一标识符
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class SubscribeHelper(metaclass=Singleton):
|
|||||||
self.get_user_uuid()
|
self.get_user_uuid()
|
||||||
self.get_github_user()
|
self.get_github_user()
|
||||||
|
|
||||||
@cached(maxsize=20, ttl=1800)
|
@cached(maxsize=5, ttl=1800)
|
||||||
def get_statistic(self, stype: str, page: Optional[int] = 1, count: Optional[int] = 30) -> List[dict]:
|
def get_statistic(self, stype: str, page: Optional[int] = 1, count: Optional[int] = 30) -> List[dict]:
|
||||||
"""
|
"""
|
||||||
获取订阅统计数据
|
获取订阅统计数据
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class Plex:
|
|||||||
logger.error(f"Authentication failed: {e}")
|
logger.error(f"Authentication failed: {e}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@cached(maxsize=100, ttl=86400)
|
@cached(maxsize=32, ttl=86400)
|
||||||
def __get_library_images(self, library_key: str, mtype: int) -> Optional[List[str]]:
|
def __get_library_images(self, library_key: str, mtype: int) -> Optional[List[str]]:
|
||||||
"""
|
"""
|
||||||
获取媒体服务器最近添加的媒体的图片列表
|
获取媒体服务器最近添加的媒体的图片列表
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
from app.core.cache import cached
|
|
||||||
|
|
||||||
from ..tmdb import TMDb
|
from ..tmdb import TMDb
|
||||||
|
|
||||||
|
|
||||||
class Trending(TMDb):
|
class Trending(TMDb):
|
||||||
_urls = {"trending": "/trending/%s/%s"}
|
_urls = {"trending": "/trending/%s/%s"}
|
||||||
|
|
||||||
@cached(maxsize=1024, ttl=43200)
|
|
||||||
def _trending(self, media_type="all", time_window="day", page=1):
|
def _trending(self, media_type="all", time_window="day", page=1):
|
||||||
"""
|
"""
|
||||||
Get trending, TTLCache 12 hours
|
Get trending, TTLCache 12 hours
|
||||||
|
|||||||
Reference in New Issue
Block a user