feat 清理缓存时清理种子缓存
This commit is contained in:
@ -192,7 +192,7 @@ class DownloadChain(ChainBase):
|
||||
channel=channel,
|
||||
userid=userid)
|
||||
if not content:
|
||||
return
|
||||
return None
|
||||
else:
|
||||
content = torrent_file
|
||||
# 获取种子文件的文件夹名和文件清单
|
||||
|
@ -60,6 +60,15 @@ class TorrentsChain(ChainBase, metaclass=Singleton):
|
||||
else:
|
||||
return self.load_cache(self._rss_file) or {}
|
||||
|
||||
def clear_torrents(self):
|
||||
"""
|
||||
清理种子缓存数据
|
||||
"""
|
||||
logger.info(f'开始清理种子缓存数据 ...')
|
||||
self.remove_cache(self._spider_file)
|
||||
self.remove_cache(self._rss_file)
|
||||
logger.info(f'种子缓存数据清理完成')
|
||||
|
||||
@cached(cache=TTLCache(maxsize=128, ttl=595))
|
||||
def browse(self, domain: str) -> List[TorrentInfo]:
|
||||
"""
|
||||
|
@ -705,8 +705,10 @@ class DoubanModule(_ModuleBase):
|
||||
"""
|
||||
清除缓存
|
||||
"""
|
||||
logger.info("开始清除豆瓣缓存 ...")
|
||||
self.doubanapi.clear_cache()
|
||||
self.cache.clear()
|
||||
logger.info("豆瓣缓存清除完成")
|
||||
|
||||
def douban_movie_credits(self, doubanid: str, page: int = 1, count: int = 20) -> List[dict]:
|
||||
"""
|
||||
|
@ -447,5 +447,7 @@ class TheMovieDbModule(_ModuleBase):
|
||||
"""
|
||||
清除缓存
|
||||
"""
|
||||
logger.info("开始清除TMDB缓存 ...")
|
||||
self.tmdb.clear_cache()
|
||||
self.cache.clear()
|
||||
logger.info("TMDB缓存清除完成")
|
||||
|
@ -13,6 +13,7 @@ from app.chain.cookiecloud import CookieCloudChain
|
||||
from app.chain.mediaserver import MediaServerChain
|
||||
from app.chain.subscribe import SubscribeChain
|
||||
from app.chain.tmdb import TmdbChain
|
||||
from app.chain.torrents import TorrentsChain
|
||||
from app.chain.transfer import TransferChain
|
||||
from app.core.config import settings
|
||||
from app.log import logger
|
||||
@ -43,6 +44,14 @@ class Scheduler(metaclass=Singleton):
|
||||
_event = threading.Event()
|
||||
|
||||
def __init__(self):
|
||||
|
||||
def clear_cache():
|
||||
"""
|
||||
清理缓存
|
||||
"""
|
||||
TorrentsChain().clear_cache()
|
||||
SchedulerChain().clear_cache()
|
||||
|
||||
# 各服务的运行状态
|
||||
self._jobs = {
|
||||
"cookiecloud": {
|
||||
@ -73,7 +82,7 @@ class Scheduler(metaclass=Singleton):
|
||||
"running": False,
|
||||
},
|
||||
"clear_cache": {
|
||||
"func": SchedulerChain().clear_cache,
|
||||
"func": clear_cache,
|
||||
"running": False,
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user